HTML head tag and element
1. HTML head element contains metadata which represents information about the HTML document.
2. It also includes links to the scripts and style sheets.
Syntax
<head>other metadata elements </head>
Category
HTML head element is part of the global structure of an HTML page.
Whether both start and end tags are required
Both start and end tags are optional.
Can contain
HTML head element can contain only following elements - base, link, meta, script, style, and title.
Can reside within
HTML head element can reside within html element only.
Attributes
Attributes specific to this element
profile - Value of the profile attribute is a URL. The URL points to a document that contains a set of rules. User agents can read those rules to understand the information contained within the meta tags.
Identifiers
Does not support.
language information and text direction
Title
Does not support.
Style
Does not support.
Events
HTML html element does not support event attributes.
Example of using HTML head element
Bellow is a simple HTML page which is containing metadata, title, and link within its head element. The head element also contains a profile attribute.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head profile="https://www.w3resource.com/profiles.html" >
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>html head tag example</title>
<link rel='stylesheet' href='test.css' type='text/css'>
</head>
<body>
<p>We are learning HTML head element. </p>
</body>
</html>
Result
View this example in a separate browser window
Pictorial presentation
Previous: DOCTYPE HTML 4.01 tutorial
Next: HTML head tag and element
Test your Programming skills with w3resource's quiz.
It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.
https://www.w3resource.com/html/head/HTML-head-tag-and-element.php
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics