DEV Community

Cover image for What is HTML headings with example?
Ravi  kumar
Ravi kumar

Posted on

What is HTML headings with example?

HTML headings are used to indicate the importance and structure of content on a web page. There are six levels of headings, with h1 being the most important and h6 being the least important.

Here is an example of how to use headings in HTML:

<h1>This is a level 1 heading</h1>
<h2>This is a level 2 heading</h2>
<h3>This is a level 3 heading</h3>
<h4>This is a level 4 heading</h4>
<h5>This is a level 5 heading</h5>
<h6>This is a level 6 heading</h6>
Enter fullscreen mode Exit fullscreen mode

The headings will be displayed in the browser with the corresponding level of importance, with level 1 headings being the largest and level 6 headings being the smallest.

Here is how the headings would be displayed in the browser:

This is a level 1 heading
This is a level 2 heading
This is a level 3 heading
This is a level 4 heading
This is a level 5 heading
This is a level 6 heading
Enter fullscreen mode Exit fullscreen mode

It's important to use headings appropriately in your HTML documents to create a clear hierarchy and structure for your content. This makes it easier for both users and search engines to understand the content on your page.

Top comments (0)