Home » HTML

HTML Head Tag

HTML Head Tag: Here, we are going to learn about the HEAD tag in HTML with its definition, syntax and examples.
Submitted by Jhanvi Tripathi, on July 28, 2019

The HEAD tag seems to play a less important role in the HTML document. This is because whatever kept in the head element indirectly visible on the browser. But the head element is having an important role in the HTML document for the web browser, as here instructions for the web browser are present also one could some extra and important information of the document about the browser, such information is called the metadata. Most of the metadata of the HTML document is not displayed on the web browser but still, it could be useful for the functionality of the webpage.

The <head> element also contains some other HTML tags which then contain the metadata. The other elements present in the HEAD tag, are in a nested form with the <head> tag as the outermost element.

The syntax for the HEAD tag,


    <!--other sub tags of HEAD tag-->
    <!--Scripts & CSS(s) etc.-->

        The head element of this document is not <br>
		directly visible on the web browser.


The output of the above code would be as follows,

html head tag output 1

In the above example, the body element is visible to the viewer. The content in the body is display by the browser while the contents of the head are for the browser.

The <title> element

The HEAD element also contains the TITLE element. The TITLE element is used to provide the title of the webpage. This title is visible to the user or visitor who visits the webpage. The title of the webpage on given in the title bar of the web browser.

The below example shows the use of the TITLE tag of HTML,


    <!--Title tag--->
    <title>The title tag in HTML </title>
    <!--End of Title tag-->

    <p>See the title of the page on the title bar.</p>


The output for the above code is as follows,

html head tag output 2

The <style> element

The style element is used to provide styling on the webpage. The <style> tag use the classes, ids or the element to provide them internal styling.

For example,

The output of the above code is as follows,

html head tag output 3

The <link> element

The <link> element is used to link to an external file to the HTML document. This external file could be the style sheets, for example:

    <link href="externalCSSfile.css" rel="stylesheet">

Comments and Discussions!

Load comments ↻

Copyright © 2024 www.includehelp.com. All rights reserved.