h1 - h6 ElementsThe h1 - h6 elements are declared by the XHTML 1.1 Text Module (Block Phrasal)
Elements in the Text Module are:span | br (Inline Structural Support Module)em | strong | q | cite | abbr | acronym | code | var | kbd | samp | dfn (Inline Phrasal Support Module)div | p (Block Structural Support Module)h1 - h6 | blockquote | pre | address (Block Phrasal Support Module)
The elements h1 to h6 represent a series of headings, from the most important (h1)
to least important (h6). They are usually rendered by a graphical browser in bold type and in a font size
which decreases as the headings get less important, but obviously CSS
can be used to set specific styles for each heading.
Headings are block level elements and cannot therefore be contained within, for example, paragraphs (denoted by the
p element) or hyperlinks (the a element).
A document usually has a main h1 title as its first heading and then the lower levels of heading
are used to subdivide the content into logical subsections. Headings should not be used merely to increase the
size of a section of text which is not a heading and also a particular heading level should never be chosen simply
because your particular browser renders that heading in the desired font size.
h2 elements should be
used to indicate subsections of content headed by an h1. Similarly, h3 elements should be used for
subsections of content headed by an h2 and so on. CSS can take care of
the presentational issues later. Personally, I have found that, by following these rules, I have never needed to use
h5 or h6 elements and only rarely use h4. I find that documents which logically require
5 or 6 levels of heading are usually better structured into several smaller documents.
This example shows the six levels of heading:
<h1>Heading Level 1</h1>
<h2>Heading Level 2</h2>
<h3>Heading Level 3</h3>
<h4>Heading Level 4</h4>
<h5>Heading Level 5</h5>
<h6>Heading Level 6</h6>
This renders as:
No styling has been applied to any of the six headings rendered above, so they are displayed using your browser's default styles.
There are no #REQUIRED attributes on the h1 - h6 elements.
There are no specific attributes declared on the h1 - h6 elements.
h1 - h6 elements are listed below:class [ type NMTOKENS ]id [ type ID ]style [ type CDATA ], from the Style Attribute Module (deprecated)title [ type Text ]xmlns [ type URI - #FIXED 'http://www.w3.org/1999/xhtml' ]dir [ type Enumeration (ltr | rtl) ], from the Bi-directional Text Modulexml:lang [ type LanguageCode ]All attributes in the
Events Attribute Collection
are supported:onclick, ondblclick, onmousedown, onmouseup, onmouseover, onmousemove, onmouseout, onkeypress, onkeydown, onkeyup
h1 - h6 elements is:
( #PCDATA | Inline.mix )*
See Content Model & Nesting for information about Content Model syntax and Nesting Groups.
h1 - h6abbr, acronym, br, cite, code, dfn, em, kbd, q, samp, span, strong, varabutton, input, label, select, textareaimgb, big, i, small, sub, sup, ttmapnoscript, scriptdel, insbdoobjectrubyh1 - h6bodyblockquote, divdd, litd, thbutton, fieldset, formmapnoscriptdel, insobject