The HTML Head Tag
By Stephen Bucaro
The structure of an html document or webpage is defined by several html tags. First, the entire
document must be contained within in opening <html> and closing </html> html tags.
Then the document is divided into two sections, the head and the body. The
head section is defined by opening <head> and closing </head> tags. The
body section is defined by opening <body> and closing </body> tags.
The visible part of the webpage is coded within the body section. However, the Web
browser reads and parses the head section of the document first. Within the head
section, the browser finds the title of the webpage, which must be contained within in opening
<title> and closing </title> title tags.
Other information which must be examined by the browser (and the Web server) before the
webpage can be rendered are contained within the head section and within opening and
closing meta, style, and script tags. Shown below is the tag structure of a
basic html document.
<html>
<head>
<title>Title of the Webpage</title>
</head>
<body>
The content of the Webpage
</body>
</html>
To be in compliance with the html specification you must include a <!DOCTYPE> declaration
at the top of your document. There are several different <!DOCTYPE> declarations. The
<!DOCTYPE> declaration tells the browser which version of html you're using and how to
interpret the documents code. Shown below is a basic html document with a <!DOCTYPE> declaration.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Title of the Webpage</title>
</head>
<body>
The content of the Webpage
</body>
</html>
One important meta tag that should be contained within the head section is the
meta http-equiv=Content-Type. This tag tells the browser how to convert the file's
bytes into characters, and tells the server how to generate headers when it serves the document.
There are several different meta http-equiv=Content-Type for different languages.
Shown below is a basic html document with a meta http-equiv=Content-Type tag for
the western English language,
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<meta http-equiv=Content-Type content="text/html; charset=windows-1252">
<title>Title of the Webpage</title>
</head>
<body>
The content of the Webpage
</body>
</html>
It is very common to mislabel Windows-1252 text with the charset label ISO-8859-1. A result
is that all the quotes and apostrophes are replaced with question marks or boxes on non-Windows
operating systems, making the text difficult to read.
More HTML Code: • Use fieldset to Organize Form Elements • Radio Button Basics • HTML Special Characters - Character Entities • Divide a Table Into Head (thead), Body (tbody), and Footer (tfoot) Sections • Web Color Names Table • HTML abbr and acronym Tag • Creating a Subscript or Superscript with HTML • Image Map Basics • Most Usefull ASCII Character Code Entities • Aligning an Image on Your Web Page
|