What Is the HEAD Element for on a Web Page?

The First Elements in an HTML Document

Business people admiring new large computer and throwing away old obsolete equipment
Business people admiring new large computer and throwing away old obsolete equipment. PW Illustration/Getty Images

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 elementHTML.a Like this:

 



  
    Your Title Here
  
  

The TITLE Element

You should always include ann 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.
  3. 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:

 

And in HTML5 you would write :

 

Th e 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:

 


  
    
    Write a Descriptive Title Here