Home »
HTML
HTML Head Tag
By IncludeHelp Last updated : October 13, 2024
HTML <Head> Tag
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.
Example of HTML <Head> Tag
The example 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,
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> Tag
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.
Example
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,
The <style> Tag
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.
Example
For example,
The output of the above code is as follows,
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:
Example
<link href="externalCSSfile.css" rel="stylesheet">