Renders text as levels of section headings. | HTML 2, 3.2, 4, 4.01, 5 |
HTML Syntax
<h1
class = classname
id = value
style = css_style_rules
title = text
>
NOTE: Both start and end tags are required.
The <h1
> to <h6
> elements are used to define six levels of different sized headings.
The numbers serve to group levels of section content: h1 for the top-level section, h2 for a subsection, h3 for a sub-subsection, and so on.
You can think of headings as introductory labels for each section’s content, as in a book: h1 for the title, h2 for chapter headings, h3 for section headings, h4 for article headings, and so on.
Headings are usually displayed in a bolder and larger font than normal body text, with level 1 headings ( <h1
> ) being the most prominent, and level 6 headings ( <h6
> ) the least.
Heading information can be used by browsers and screen readers to generate an outline or a table of contents for a document automatically. For conformity, authors are advised not to skip heading levels, so the outline will consistently start from h1, followed by h2 and so on.
Heading elements create a block-level box in the layout, starting on a new line and taking up the full width available in their containing block.
The <h1 - h6>
element has no attribute of its own, but supports global attributes common to all HTML elements.
The following example shows how CSS can be used to apply styles to heading elements.
Show me
HEADER Using Heading Elements