The Web Design Group

h2 - Level-two Heading

Syntax <h2>...</h2>
Attribute Specifications
  • align=[ "left" | "center" | "right" | "justify" ] (horizontal alignment)
  • common attributes
Contents Inline elements
Contained in applet, blockquote, body, button, center, del, dd, div, fieldset, form, iframe, ins, li, map, noframes, noscript, object, td, th

The h2 element defines a level-two heading. This heading is more important than an h3 but less important than an h1.

The deprecated align attribute suggests the horizontal alignment for the heading on visual browsers. Possible values are left, right, center, and justify. Style sheets provide greater flexibility in suggesting alignment.

Visual browsers typically render h2 in a large, bold font. Authors can suggest a presentation for h2 through style sheets. The following CSS ruleset suggests a presentation for all h2 elements:

h2 {
  color: #00008b;
  background: transparent;
  font-weight: bold;
  margin-left: 2%;
  margin-right: 2%

Authors should not choose a heading level based on the font size commonly used by visual browsers. The heading level should be chosen based on the heading's importance and placement in the document. An h2 is typically used within a section headed by an h1.

More Information