In HTML document head is an element of the document. This element contains all information about the document or the text. Head is always the first element of the HTML document and it must come after the starting tag of the HTML document that is <HTML>.
The head element
The head contains all the general information about the HTML document. The information that is contained by the head is not displayed as the part of the document of HTML. Only some elements of the HTML document are appropriate within the head. All the head elements accept the title element are empty. A head element can contain the following elements in it:
Title element, Base element, Isindex element, nextid element, link element, meta element.
But the head element can only be placed inside an html element. It does not have any attributes.
<title> This is the tile </title>
<h1> This is the heading </h1>
<p> this is the first paragraph </p>
The base element
The syntax of base element is as follows:
This element does not contain any other element or elements. It can be inside the head element. The base element can also use the HREF attribute.
Base is an empty element and is also optional to use. Base has a single but mandatory attribute that is HREF which is used to assign the base URL of the document. Where the base URL is the URL that indicates the location of the document. If the base element is not used the browser will use the URL relative to the URL that was used to access the document. Some of the older browsers do not support the BASE element. It is used as follows:
<title> the title </title>
<base href = “the url”>
The ISINDEX element
The ISINDEX element is also an empty element and is optional to use. The ISINDEX element can be declared inside the body element, head element, form and BLOCKQUITE, LI, and DD elements. This element informs the browser that the HTML document can be checked or examined using the keyword search.
<title> title text </title>
…body of document
The link element
The link element is used to describe the relationship between a document and other documents. For example, you might use LINK to relate a glossary to your document. The LINK element is empty that is it does not contain any elements. It is also optional. The link element uses the attributes a, HREF, NAME, etc. The link element has been explained above with examples.
The META element
The meta element is used to provide a place to put meta information that is not defined by the other head elements. This element also provides the user to describe the document content for indexing etc. But the Meta element cannot be used as HEAD element.
The Meta element does not contain any elements that is this element is empty. The meta element can be inside the head element. It contains HTTP-EQUIV, NAME and CONTENT attributes.