HTML Headings Tags
Headings are used to provide structure and hierarchy to your HTML content. The <h1>
to <h6>
tags are used to define headings in HTML. The <h1>
tag represents the most important heading, while the <h6>
tag represents the least important heading.
Usage of <h1>
to <h6>
tags:
The <h1>
tag is typically used for the main heading or title of a page. It is important for SEO and accessibility purposes to use the <h1>
tag only once per page.
The <h2>
to <h6>
tags can be used to further structure and organize the content on the page. They indicate different levels of importance within the content.
Main Attributes of <h1>
to <h6>
tags:
Tag | Attribute | Description |
---|---|---|
<h1> |
id | Specifies a unique id for the heading |
<h2> |
class | Specifies one or more classes for the heading |
<h3> |
style | Specifies a inline style for the heading |
Examples:
<h1>Welcome to my Website</h1>
<h2 class="subheading">About Us</h2>
<h3 style="color: blue;">Our Mission</h3>
In the above examples, we have used various <h1>
to <h3>
tags with different attributes to create headings with different styles and meanings.