Home : Basic HTML/CSS tutorial : Basic HTML : Boilerplate HTML
Introduction
Example
Tags
Simple tags
Boilerplate HTML
Summary
References
< Previous: Simple tags

Boilerplate HTML

Some HTML content is standard throughout most pages and rarely needs to be changed. You could copy this from a previously-written page (or from that example source) when you start a new page.

Web browsers will still be able to display your pages even if you miss out some of these tags, but it's good practice to include all of them.

<!doctype ...

DOCTYPE is a special tag; note that it begins with an exclamation mark. It is only used at the start of a document. Technically, it indicates (to browsers and to other tools) which version of HTML is in use.

The DOCTYPE tag included references the "strict" version of HTML 4.0, which is defined at the World Wide Web Consortium (W3C)'s web site. However, you don't need to understand this tag; it can simply be copied into the start of each web page.

<html>

The HTML tag indicates where the HTML document begins and ends. (!DOCTYPE is not technically part of the HTML document, which is why it's outside the HTML tag.)

<head>

HEAD contains the header of the HTML document. The header is used for information that isn't actually shown as part of the visible page but may be used in some other way.

The document TITLE is part of the header, because it isn't shown as part of the main page (even though browsers may display it in the title bar). Other information is sometimes included, such as a description of the page's contents, or a list of keywords that might help to index the page.

<body>

The BODY tag contains the displayed portion of the page (here, the heading and a few paragraphs of text). Everything that is displayed in the main page will be included within this tag.