HTML CSS examples for HTML Tag:h1-h6
HTML defines a hierarchy of heading elements, with h1 being the highest ranked.
The other heading elements are h2, h3, through to h6.
The h1-h6 Elements summary
Item | Value |
---|---|
Element: | h1-h6 |
Element Type: | Flow |
Permitted Parents: | The hgroup element or any element that can contain flow elements. These elements cannot be descendants of the address element. |
Local Attributes: | None |
Tag Style: | Start and end tags |
New in HTML5? | No |
Changes in HTML5 | None |
Style Convention
Element | Style Convention |
---|---|
h1 | h1 { display: block; font-size: 2em; margin-before: 0.67em; margin-after: 0.67em; margin-start: 0; margin-end: 0; font-weight: bold; } |
h2 | h2 { display: block; font-size: 1.5em; margin-before: 0.83em; margin-after: 0.83em; margin-start: 0; margin-end: 0; font-weight: bold; } |
h3 | h3 { display: block; font-size: 1.17em; margin-before: 1em; margin-after: 1em; margin-start: 0; margin-end: 0; font-weight: bold; } |
h4 | h4 { display: block; margin-before: 1.33em; margin-after: 1.33em; margin-start: 0; margin-end: 0; font-weight: bold; } |
h5 | h5 { display: block; font-size: .83em; margin-before: 1.67em; margin-after: 1.67em; margin-start: 0; margin-end: 0; font-weight: bold; } |
h6 | h6 { display: block; font-size: .67em; margin-before: 2.33em; margin-after: 2.33em; margin-start: 0; margin-end: 0; font-weight: bold; } |
Using the h1-h3 Elements
<!DOCTYPE html> <html> <head> <title>Example</title> </head> <body> <h1>A</h1> <h2>B</h2> <h3>C</h3> <h1>HTML</h1> <h2>Introduction</h2> <h3>Why is it important</h3> </body><!--from w w w . j a va 2 s .com--> </html>