HTML headings are used to define the structure and hierarchy of content on a web page. There are six different levels of headings in HTML, from <h1>
to <h6>
, with <h1>
being the most important and <h6>
being the least important.
Below is a sample of how headings can be employed to organize and structure content on a webpage:
<!DOCTYPE html>
<html>
<head>
<title>Example Web Page</title>
</head>
<body>
<h1>Heading Level 1</h1>
<p>This is some content under the first heading.</p>
<h2>Heading Level 2</h2>
<p>This is some content under the second heading.</p>
<h3>Heading Level 3</h3>
<p>This is some content under the third heading.</p>
<h4>Heading Level 4</h4>
<p>This is some content under the fourth heading.</p>
<h5>Heading Level 5</h5>
<p>This is some content under the fifth heading.</p>
<h6>Heading Level 6</h6>
<p>This is some content under the sixth heading.</p>
</body>
</html>
In this example, the six different levels of headings are used to structure the content on the web page. The <h1>
tag is used for the main heading, and the <h2>
through <h6>
tags are used for subheadings of decreasing importance.
It’s important to use headings appropriately and to follow a logical hierarchy to make the content more organized and easy to navigate for users. Search engines also use headings to understand the structure of content on a page, so using headings correctly can help with search engine optimization (SEO).