<h1> to <h6> Tags in HTML
The <h1> to <h6> tags are used to define headings in HTML. These tags represent different levels of headings, with <h1> being the highest or most important level, and <h6> being the lowest level.
Key Points on <h1> to <h6> Tags:
- <h1> is used for the main heading of the page, and <h6> is used for the least important heading.
- Headings are important for SEO and accessibility, as they help organize content hierarchically.
- Headings automatically add space above and below the text, making it visually distinct from other content.
Syntax of <h1> to <h6> Tags:
Syntax Example
<h1>Heading 1</h1>
<h2>Heading 2</h2>
<h3>Heading 3</h3>
<h4>Heading 4</h4>
<h5>Heading 5</h5>
<h6>Heading 6</h6>
Example of <h1> to <h6> Tags in HTML:
This example demonstrates how to use the <h1> to <h6> tags to define headings of different levels.
Code Example
<!DOCTYPE html>
<html>
<head>
<title>HTML Heading Example</title>
</head>
<body>
<h1>Main Heading of the Page</h1>
<h2>Introduction to HTML</h2>
<h3>What is HTML?</h3>
<h4>History of HTML</h4>
<h5>HTML in the Early Days</h5>
<h6>HTML Today</h6>
</body>
</html>
Output
Main Heading Of the Page
Introduction to HTML
What is HTML ?
History Of HTML
HTML in Early Days
HTML Today
The <h1> to <h6> tags should be used to structure the content in a hierarchical way, where <h1> represents the most important heading and <h6> the least important. Using these tags appropriately helps with SEO and makes your content more accessible.