The HTML <head> Element
The <head> element is known as a container for metadata (data about data) which is placed between the <html> tag and the <body> tag.
HTML metadata is known as the data about the HTML document. Metadata is not getting displayed.
Metadata typically is used to define the document title, character set, styles, links, scripts, and other meta information.
The following tags are used to describe metadata: <title>, <style>, <meta>, <link>, <script>, and <base>.
The HTML <title> Element
The <title> element is used to define the document title, and is needed in all of the HTML/XHTML documents.
The <title> element:
A simple HTML document:
The HTML <style> Element
The <style> element defines style information of a single HTML page:
The HTML <link> Element
The <link> element is utilised for linking external style sheets:
Tip: To learn more about CSS, you can study our CSS Tutorial.
The HTML <meta> Element
The <meta> element is utilised for specifing which character set is used, page description, keywords, author, and other metadata.
Metadata is utilised by browsers (for displaying content), by search engines (keywords), and other web services.
Defining the character set being used:
Defining a description for your web page:
Defining keywords for using in search engines:
Defining the author of a particular page:
Inorder to refresh document every 30 seconds:
Example of <meta> tags:
The HTML <script> Element
The HTML <base> Element
The <base> element is used to specify the base URL and all the required relative URL's base target present in a page:
Omitting <html>, <head> and <body>?
In accordance to the HTML5 standard; the <html>, the <body>, and the <head> tag can be omitted.
The following code is used to validate as HTML5:
Note: NGO is not recommending omission of the ,, and tags. Omission of these tags can lead to crash of DOM/XML software and can possibly produce errors in older browsers.
HTML head Elements
|<head>||Defines information about the document|
|<title>||Defines the title of a document|
|<base>||Defines a default address or a default target for all links on a page|
|<link>||Defines the relationship between a document and an external resource|
|<meta>||Defines metadata about an HTML document|
|<script>||Defines a client-side script|
|<style>||Defines style information for a document|