HTML heading tags
HTML heading tags has 6 levels of elements. They are –
<h1>, <h2>, <h3>, <h4>, <h5>, and <h6>.
The <h1> tag is used for main title or main heading of the page.
<h2> to <h6> tags are used for subheadings or subtitles of the Web page.
The sizes from <h1> to <h6> tags keep on decreasing.
For Example:
<h1> element is biggest in terms of size.
<h2> element is bigger in size than <h3> element while the <h3> element is bigger in size than <h4> element.
Similarly, the <h4> element is bigger than the <h5> element and the <h5> element is bigger in size than <h6>.
Syntax:
<h1>text</h1>
<h2>text</h2>
<h3>text</h3>
<h4>text</h4>
<h5>text</h5>
<h6>text</h6>
Example
<h1> This is heading 1 </h1> <h2> This is heading 2 </h2> <h3> This is heading 3 </h3> <h4> This is heading 4 </h4> <h5> This is heading 5 </h5> <h6> This is heading 6 </h6>
Default CSS Values
display: block;
margin-top: 0.67em;
margin-bottom: 0.67em;
margin-left: 0;
margin-right: 0;
font-weight: bold;
font-size: 2em; (h1)
font-size: 1.5em; (h2)
font-size: 1.17em; (h3)
font-size: 1.33em; (h4)
font-size: 0.83em; (h5)
font-size: 0.67em; (h6)
How Browser will display
BLOCK Level.
Difference between HTML4.01, XHTML and HTML5
HTML4 | XHTML | HTML5 |
---|---|---|
NA | NA | align attribute is deprecated with this tag in HTML5. |
Attributes used with heading tags
Attribute | Description |
---|---|
align | To align the text inside these heading element to justify, right, left or center. (HTML5 does not support this attribute when it is used with any of these heading tags). |
Global Attributes
All Heading tags supports Global attributes.
Event Attributes
All Heading tags supports Event attributes.
Supporting Browsers
Related Tags
<p> tag – To create paragraphs.