HTML <head> tag represents a heading section or information about web page.
HTML head tag generally used to define web page title(that we can see on browsers tab), scripts(to handle client-side events), styles(to format web page), meta information etc.
The head section of web page can contains some HTML elements like <base> tag, <link> tag, <meta> tag, <noscript> tag, <script> tag, <style> tag, <title> tag.
Note: The <head> tag elements are invisible in body section for any web page. See more details about HTML <body> tag elements that are used for visible contents.
HTML <head> tag mostly supported in all major web browsers.
Sample Code
<head>
<title>HTML head Tag With Example</title>
<meta name="keywords" content="HTML Head Elements, Webblogsforyou">
<meta name="description" content="Webblogsforyou post on HTML Head Elements">
<link rel="stylesheet" type="text/css" href="style.css">
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<script type="text/javascript" src="script.js"></script>
</head>
<body>
<!– Begin Body Part –>
<p> Start Body Content From Here </p>
<!– End Body Part –>
</body>
</html>
Sample Result
Start Body Content From Here
Standard Attributes Support
HTML <head> tag supports mostly all HTML Attributes. Following are some most common attributes that are used by <head> tag. You can get more details about available HTML Attributes here.
Attribute | Value | Description |
---|---|---|
class | user_defined | Represents a style for an element which is used in CSS style sheet |
id | user_defined | Represents unique id for an element |
lang | lang_code | Represents the language of the element for it’s content |
style | css_properties | Represents an inline style for an element for e.g style=”color:red;text-decoration:underline;” |
title | user_defined | Represents a tooltip information for an elements like img, a, abbr etc |
Event Attributes Support
HTML <head> tag does not support Event Attributes. But you can get more details about available HTML Event Attributes here.