HTML <head> tagS2C Home   « HTML <head> tag

Definition

The <head> tag denotes the document head element of a HTML document.

The <head> tag must come directly after the <html> opening tag and its closing </head> tag must precede the <body> opening tag.

The <head> element can contain the following tags:

<base />, <link />, <meta />, <script>, <style> and <title>.

The <title> tag is the only required tag of the <head> element.

Example


<html  xmlns="http://www.w3.org/1999/xhtml">
<!-- Everything goes between the start and end HTML tags. --> 

<head>
<!-- The header contains meta information pertaining to the HTML document as well 
as a title and other stuff we will discuss in HTML Intermediate/Advanced lessons.
External files such as CSS stylesheets and JavaScript files are also imported in
the header section of our HTML file. -->
	
  <title>A Title which will appear in the Windows title bar.</title>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  <base href="http://server2client.com/" />
  <link href="../global.css" rel="stylesheet" type="text/css" />
  <script src="../js/jquery.js" type="text/javascript"></script>
  <script type="text/javascript">Javascript in here</script>
  <style type="text/css">CSS in here</style>
</head>

<body>
<!-- The content of the web page appears in the body section. -->
</body>

<!-- We complete the HTML file with the closing HTML tag. -->
</html>

Required Attributes

NONE

Optional Attributes

profile - specifies the URL location(s) of a meta data profile.


<head profile="aURL"></head>

Common Attributes

NONE

Language Attributes

dir - specifies the directional flow of the content.


<head dir="ltr"></head>   <!-- The text will flow from left to right -->
<head dir="rtl"></head>   <!-- The text will flow from right to left -->

lang - specifies a language code for the content of the element.


<head lang="en">Some text here</head>

xml:lang - specifies a language code for the content of the element in XHTML documents.


<head xml:lang="fr">Some text here</head>

Event Attributes

NONE

go to home page Homepage go to top of page Top