Quick Guide To HTML Headings

In this article, we’ll cover the different types of HTML headings and how to use them effectively in web design.

Headings are one of the most important elements of HTML, as they provide structure and organization to web content.

Headings Example:

This is H1 heading Example

This is H2 heading Example

This is H3 heading Example

This is H4 heading Example

This is H5 heading Example
And this is H6 heading Example


HTML Headings

HTML provides six different levels of headings, from h1 to h6.

The h1 heading is the most important and should be used for the main title of the page, while the h2 heading should be used for subheadings and so on.

Here’s an example:

Example

<!DOCTYPE html> <html> <body><h1>Here we have used h1 heading tag</h1> <h2>Here we have used h2 heading tag</h2> <h3>Here we have used h3 heading tag</h3> <h4>Here we have used h4 heading tag</h4> <h5>Here we have used h5 heading tag</h5> <h6>Here we have used h6 heading tag</h6></body> </html>

Example Explanation

This code above represents an HTML document that contains six different heading tags (h1, h2, h3, h4, h5, and h6) which are used to define the headings at different levels on a webpage.

  • The text “Here we have used the h1 heading tag” is written inside the first heading tag, which is h1. The h1 tag is used for the main title of the webpage, and it is the largest and most important heading tag.
  • The text “Here we have used the h2 heading tag” is written inside the second heading tag, which is h2. The h2 tag is used for the subheadings and titles of sections on the webpage, and it is slightly smaller than the h1 tag.
  • The text “Here we have used the h3 heading tag” is written inside the third heading tag, which is h3. The h3 tag is used for the subheadings of subsections on the webpage, and it is smaller than the h2 tag.
  • The text “Here we have used the h4 heading tag” is written inside the fourth heading tag, which is h4. The h4 tag is used for the headings of sub-subsections on the webpage, and it is smaller than the h3 tag.
  • The text “Here we have used the h5 heading tag” is written inside the fifth heading tag, which is h5. The h5 tag is used for the headings of sub-sub-subsections on the webpage, and it is smaller than the h4 tag.
  • The text “Here we have used the h6 heading tag” is written inside the sixth heading tag, which is h6. The h6 tag is used for the headings of the smallest and least important subsections ionthe webpage, and it is the smallest heading tag.
Reminder: Please keep in mind that browsers include some white space (a margin) before and after a heading.

Using Headings Effectively

When using HTML headings, it’s important to follow a few best practices to ensure that your content is accessible and easy to understand.

Here are some tips:

  • Headings are used by search engines to index the structure and content of your web pages. Headings should be used to structure your content in a logical and organized way, making it easy for users and crawlers to scan and find what they’re looking for.
  • Users often watch a page based on its titles. Make sure that your headings are descriptive and accurately reflect the content of the section they’re introducing. This will make it easier for users to understand what each section is about.
  • Use only one <h1> per page. (Using multiple h1 headings can confuse users and make it difficult for search engines to understand the structure of your content.)
  • When using multiple headings on a page, make sure that they follow a hierarchical structure, with h2 headings being used for subheadings and so on.

Html Headings Color

There is a default color for each HTML heading. If you would like to specify the color for a heading, you can do so through the style attribute, using the CSS Color property. See example below:

Example: 

<!DOCTYPE html> <html> <body> <h1 style="color: red;">Mr Example H1 Title</h1> </body> </html>


Bolder Heading

There is a default weight for every HTML headings. If you would like to change the weight for a heading, you can do so through the style attribute, through the CSS font-weight property. See example below:

Example: 

<!DOCTYPE html> <html> <body> <h4 style="font-weight: 900;">Mr Example H1 Title</h4> </body> </html>

Heading Decoration

HTML headings are usually style simple and bold but if you would like to style it differently you can do it using the style attribute, applying the CSS text-decoration property. See example below:

Example: 

<!DOCTYPE html> <html> <body> <h1 style="text-decoration: underline;">Mr Example H1 Title</h1> </body> </html>


Bigger Headings

There is a default size for every HTML headings. If you would like to specify the size for a heading, you can do so through the style attribute, using the CSS font-size property. See example below:

Example

<!DOCTYPE html> <html> <body><h1 style="font-size:55px;">Mr Example H1 Title</h1></body> </html>

HTML Tag Reference

When we talk about HTML headings then, a description of these tags and the attributes they contain can be found in Mr Examples‘ tag reference below.

TagsOverview
<html>The foundation of an HTML document.
<body>Describes the body of the document.
<h1> to <h6>HTML headings are defined here.
Visit our HTML Tag Reference for a comprehensive list of all possible HTML tags.

Conclusion

HTML Headings play an important role in structuring and organizing web content. In addition to providing hierarchy, they make the content easier to understand for humans and search engines.

You should use headings sequentially, avoid skipping levels, and use descriptive and concise text when using headings. With the help of HTML headings, you can enhance your website’s accessibility and user experience as well as boost its search engine optimization (SEO).

Do subscribe to our Newsletter to get the latest technical information from our site.
We value your feedback.
+1
0
+1
0
+1
0
+1
0
+1
0
+1
0
+1
0

Subscribe To Our Newsletter
Enter your email to receive a weekly round-up of our best posts. Learn more!
icon

Leave a Reply

Your email address will not be published. Required fields are marked *