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,

<html>

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

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

</html>

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,

<html>

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

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

</html>

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

Ad: Are you a blogger? Join our Blogging forum.




Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates


© https://www.includehelp.com some rights reserved.