HTML TAGS Document Elements Root elements provide the containers enclosing all other HTML elements. Every HTML page has these elements. The surrounding tags may be omitted. However, some utilities may not recognize or correctly handle the document if this is done.

… Delimit an HTML document (i.e. instead of an XML or another class document). The HTML element takes the attributes lang for the primary language for the document (such as en for English) and a profile for a URI specifying for the document (rarely used). The only contents allowed in an HTML element is one head element and one body element. (See Frames, below, for an exception where body is not used.)

… Delimit the header section of the document, which contains information about the page. The head element basically contains the metadata for the document. There are seven possible head elements including a for extensible specification of metadata.

… Delimit the body section of the document, which contains the displayed content of the page.

These root elements are arranged as follows:

Any of the various head related elements arranged in any order and occurring any number of times except base and title which can only occur once each. Title is the only required head element. At least one of either a block element or a script element must occur,(though any number may occur), arranged in any order to suit the meaning and also typically the presentation of the document. The ins and del elements are also permissible within the body element when used as block level elements. The other block elements are: paragraph (p), heading (h1...h6), block quotation (blockquote), ordered list (ol), unordered list (ul), definition list (dl), division (div), no script support (), (form), table (table), fieldset (fieldset), and address (address). No other HTML elements are valid within the body element.

Nesting of elements Nesting describes the structural relationship between tags in HTML code. When A is nested inside Tag B, then Tag A should be opened and closed before Tag B is closed. Mixing up the tags can cause unpredictable results.

Let's look at a simple example first:

This text is in bold for emphasisand this is underlined.This should be underlined, but not bold

Note that we closed the bold tag inside the underline tag. The designer may expect the browser to stop rendering the text in bold, but keep underlining. That doesn't always happen.

Netscape 4.x renders the text like this:

This text is in bold for emphasis and this is underlined. This should be underlined, but not bold.

While Explorer 5.0 and Netscape 6.0 interpret it this way:

This text is in bold for emphasis and this is underlined. This should be underlined, but not bold.

Netscape 4.x swaps the closing bold and underline tags. This closes the tags in the proper order according to HTML standards - but may cause unanticipated results.

1 Basic Tags

Section headings at different levels. Use

for the highest-level heading (the major sections),

for the next level down (sub-section),

for a level below that, and so on. The lowest level heading is

. Most web browsers will show

as large text in a different font, and

as small bold- faced text, but this can be overridden with CSS. The heading elements are not intended merely for creating large or bold text: they describe something about the document's structure and organization. Some programs use them to generate outlines and tables of contents.

This is header 1

This is header 2

This is header