HTML supports six levels of heading. HTML Headings make text bold.
Each Headings creates a different size – h1, h2, h3, h4, h5, h6 and they must be closed /h1, /h2, /h3, /h4, /h5, /h6. Headings tags also automatically create a paragraph break below their contents.
Headings are block elements.
Example
<!DOCTYPE html> <html> <body> <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> </body> </html>
Output
This is heading 1
This is heading 2
This is heading 3
This is heading 4
This is heading 5
This is heading 6
Use heading tags only for headings. Don’t use them just to make something bold or big. Use other tags for that.
Headings Are Important for SEO
HTML headings play the most important for search engines to index the layout and content of your web pages. The <h1> tag is only used once. It is considered to be the main heading of the page and shouldn’t be used multiple times.
<h2> to <h6> however, can be used as frequently as you wish. But HTML Headings should always be used in order, as they were intended.
For example, an h4 heading should be a sub-heading of an h3 heading, which should be a sub-heading of an h2 heading.