How to Create an HTML Document Head
In an HTML document, many things can be included in the HEAD element. In this article you'll learn which elements are most important.
- Difficulty:
- Moderately Easy
Instructions
-
-
1
Even before the HEAD, an (X)HTML document should contain a DOCTYPE. Refer to my eHow article on DOCTYPES if you need more information (see Resources below).
-
2
The most important elements to include in the HEAD are the TITLE (which is required) and any optional META, LINK and SCRIPT elements that may be needed.
-
3
A Title Element
The TITLE gives the document a name, which will appear at the top of the browser window, and will also be used when bookmarking a page and when displaying search engine results. You want important keywords in the title element. This image shows the beginnings of a head element.
-
4
Meta Elements
Next you want META elements. There are many meta elements, but the most important ones to include are description and keywords. These meta elements get read by most of the search engines. The description, in particular, may be given in search results.
-
5
Link Elements
If you are using CSS to style your web page, you need to include LINK elements that link to all the external style sheets you are using. To be clear about where styles go, you want them in an external style sheet connected to your HTML page with a LINK element. You need a separate link element for each style sheet you are using.
-
6
Script Element
If you have any JavaScripts, they need to be externalized as well, with a SCRIPT element in the head linking them to your page.
-
1
Tips & Warnings
There are numerous other elements that may appear in a document head.
Related Searches
Resources
Comments
-
maryanne09
Mar 15, 2009
Great article. :o) -
Janet Ford
Nov 23, 2008
Great explaination. Thank you. I love your use of screenshots. Very helpful. 5 stars