What is the HEAD Element For?

The First Elements in an HTML Document

At the top of most HTML documents there are elements that don’t display on web pages (for the most part). These elements are hidden from readers but they are very useful to your web pages and shouldn’t be left out unless you have a good reason to.

Technically, there is only one tag that is required to be at the top of all HTML documents: the element. This required (in HTML 4.01) element is only valid within the element, which is only valid within the element.

In other words, the first few lines of all valid HTML 4.01 documents should look like this:


You can also include a DOCTYPE tag above the HTML element. Like this:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <title> Your Title Here </title>
  <body> .... the rest of your HTML document </body>

The TITLE Element

You should always include a on your web page. As I said above, it is required in HTML 4.01, but there are two other good reasons to do it, such as:

  1. Search engines use the TITLE as the primary means of cataloging sites. If your web page doesn’t have a descriptive title the search engines will give it a lower ranking than other pages. This is also what displays as the link text in search engine results.
  2. It displays at the top of the browser window or in the tab, describing the page in the browser.
  1. It is what is written when someone bookmarks your site. If people bookmark your site, you want them to remember it was your site and not “untitled”.

The HTML and HEAD Elements

As I mentioned above, both of these elements are required because of the TITLE element. They define your document and provide a location for hidden information, like META tags that can improve your site’s standing in search engines.

Meta Information or Meta Data

Meta information is data contained in the HEAD of your HTML document to provide additional information about your web page. You can include information like the author’s name, the program that was used to create the page, the date the page should expire, and, perhaps most importantly, descriptions and keywords for search engines.

But the most important META tag you should include on your web documents is the character set, or charset. This is important for the security of your web pages. In HTML 4.01, you would write:

<meta http-equiv="content-type" content="text/html; charset=utf-8">

And in HTML5 you would write:

<meta charset="utf-8">

The character set should always be the first line in your HEAD so that hackers cannot break in.

Learn More About Meta Tags

Meta tags are very important to get good ranking in search engines. But if you only have time to write either a good, descriptive title or meta tags, write the title. The title of your document will go further for search engine placement than meta tags.

The Top of Your Document

The top of your HTML documents with all the above information, will look like this:

    <meta http-equiv="content-type" content="text/html; charset=utf-8">
    <title>Write a Descriptive Title Here</title>
    <meta name="description" content="a short description of the content of the website using keywords found in the title and your meta keywords">
    <meta name="keywords" content="keywords that describe your site; use the same ones in your title and description">