HTML XHTML The Complete Reference
home » reference » appendix a » html element reference

<h1> Through <h6> (Headings)

These tags implement six levels of document headings; <h1> is the most prominent, and <h6> is the least prominent.

Standard Syntax

align="center | justify | left | right" (transitional only)
class="class name(s)"
dir="ltr | rtl"
id="unique alphanumeric identifier"
lang="language code"
style="style information"
title="advisory text"

Attributes Defined by Internet Explorer

accesskey="key" (5.5)
contenteditable="false | true | inherit" (5.5)
disabled="false | true" (5.5)
hidefocus="true | false" (5.5)
language="javascript | jscript | vbs | vbscript" (4)
tabindex="number" (5.5)
unselectable="on | off" (5.5)

Standard Events

onclick, ondblclick, onkeydown, onkeypress, onkeyup, onmousedown, onmousemove, onmouseout, onmouseover, onmouseup

Events Defined by Internet Explorer

onactivate, onbeforeactivate, onbeforecopy, onbeforecut, onbeforedeactivate, onbeforeeditfocus, onbeforepaste, onblur, oncontextmenu, oncontrolselect, oncopy, oncut, ondeactivate, ondrag, ondragend, ondragenter, ondragleave, ondragover, ondragstart, ondrop, onfocus, onfocusin, onfocusout, onhelp, onlosecapture, onmouseenter, onmouseleave, onmousewheel, onmove, onmoveend, onmovestart, onpaste, onpropertychange, onreadystatechange, onresize, onresizeend, onresizestart, onselectstart, ontimeerror

Element Specific Attributes

This attribute controls the horizontal alignment of the heading with respect to the page. The default value is left.


<h1>This is a Major Document Heading</h1>
<h2 align="center">Second heading, aligned to the center</h2>
<h3 align="right">
Third heading, aligned to the right</h3>
Fourth heading</h4>
<h5 style="font-size: 20pt">
Fifth heading with style information</h5>
The smallest heading</h6>


HTML 2, 3.2, 4, 4.01, XHTML 1.0, 1.1, Basic
Internet Explorer 2, 3, 4, 5, 5.5, 6
Netscape 1, 2, 3, 4, 4.5-4.8, 6, 7
Opera 4-7


In most implementations, heading numbers correspond inversely with the six font sizes supported by the <font> element. For example, <h1> corresponds to <font size="6">. The default font size is 3. However, this approach to layout is not encouraged and page designers should consider using styles to set even relative sizes.

HTML 3.2 supports only the align attribute. HTML 2 does not support any attributes for headings.

The strict definition of HTML 4.01 does not include support for the align attribute. Style sheets should be used instead.

(X)HTML Elements
CSS Properties
Previous: frameset Next: head
< Home | About | Chapters | Examples | Errata | Reference | Site Map >