HTML headings are used to structure the content of a webpage, and are defined with the <h1> to <h6> tags. The <h1> tag is used for the main heading of a page, and <h6> is used for the least important heading. HTML headings are important for providing structure to webpages, making them easier to read and navigate.
<h1> defines the most important heading and important for SEO. And by default, it has the largest font size (We can change the font size anytime using CSS).
<h6>
defines the least important heading. And it has the smallest font size by default (We can change the font size anytime using CSS).
Note: Browsers automatically add a space (margin) before and after a heading tag.
Example output of HTML headings
Heading 1
Heading 2
Heading 3
Heading 4
Heading 5
Heading 6
Note: Don’t use heading tags to make text Big and Bold. Use only for headings.
<!DOCTYPE html>
<html>
<head>
<title>HTML heading tags</title>
</head>
<body>
<!--visible-start-->
<h1>heading 1</h1>
<h2>heading 2</h2>
<h3>heading 3</h3>
<h4>heading 4</h4>
<h5>heading 5</h5>
<h6>heading 1</h6>
<!--visible-end-->
</body>
</html>