HTML HTML Tutorial HTML Forms HTML Graphics HTML Media HTML APIs HTML Tags



HTML Headings

HTML headings are used to define the headings or titles of a web page. They are important for structuring the content of a web page and making it more readable and accessible to users. HTML headings range from h1 to h6, with h1 being the most important and h6 being the least important.

Usage of HTML Headings

HTML headings are used to define the structure of a web page. They are used to indicate the main topics and subtopics of a web page. The main heading of a web page should always be h1, and subsequent headings should be used in descending order of importance. This helps search engines and users to understand the content of the web page and its hierarchy.

Code Examples

The following code examples demonstrate the usage of HTML headings:

Example 1:

<h1>Welcome to my website</h1>
<h2>About Us</h2>
<h3>Our History</h3>
<h3>Our Team</h3>
<h2>Services</h2>
<h3>Web Design</h3>
<h3>SEO</h3>
<h2>Contact Us</h2>

In this example, the main heading of the web page is h1, which indicates that the web page is about the website. The subheadings are h2, which indicate the main topics of the web page. The subtopics of each main topic are h3, which indicate the subtopics of the web page.

Example 2:

<h1>HTML Headings</h1>
<p>HTML headings are used to define the headings or titles of a web page.</p>
<h2>Usage of HTML Headings</h2>
<p>HTML headings are used to define the structure of a web page.</p>
<h2>Code Examples</h2>
<p>The following code examples demonstrate the usage of HTML headings:</p>

In this example, the main heading of the web page is h1, which indicates that the web page is about HTML headings. The subheadings are h2, which indicate the main topics of the web page. The paragraphs are used to provide more information about each topic.

Example 3:

<h1>My Blog</h1>
<h2>Latest Posts</h2>
<h3>Post 1</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
<h3>Post 2</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
<h2>Categories</h2>
<h3>Technology</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
<h3>Travel</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>

In this example, the main heading of the web page is h1, which indicates that the web page is about a blog. The subheadings are h2, which indicate the main topics of the web page. The subtopics of each main topic are h3, which indicate the subtopics of the web page. The paragraphs are used to provide more information about each topic.

Conclusion

HTML headings are an important part of web page structure and organization. They help to make the content of a web page more readable and accessible to users. By using HTML headings correctly, web developers can improve the SEO of their web pages and make them more user-friendly.

References

Activity