HTML Headings Tags


HTML headings are used to create headings and subheadings within a webpage. They are represented by the <h1> to <h6> tags.

There are 6 levels of headings in HTML:

  • h1 - used for the main heading of the webpage and is typically the largest in size
  • h2 - the second level of headings
  • h3 - the third level of headings
  • h4 - the fourth level of headings
  • h5 - the second smallest level of headings
  • h6 - being the most smallest heading size

Using headings properly can improve the accessibility and readability of a webpage for users. Search engines also use headings to understand the structure and content of a webpage. It's good practice to have only one h1 heading per page, and then use the other headings accordingly.

For example, you could use an <h1> for the title of an article, and then use <h2> for the subheadings within the article. You could also use <h3> for sub-subheadings and so on. This helps to organize the content and make it easier for users to navigate and understand the page.

This is an example of HTML code which creates a webpage with different levels of headings. The code creates an HTML document with a head and a body. Within the head, there is a title element which sets the title of the webpage as "Heading Tags".

In the body, there are six heading elements, each with a different level from h1 to h6. These headings are used to organize and structure the content of the webpage. The h1 heading is the highest level and is used for the main heading of the webpage, while h2 is used for subheadings, h3 for sub-subheadings and so on. The text within each heading element will be displayed as a heading on the webpage.

The most common attribute used in heading tags is the "id" attribute, which allows you to create an anchor link that can be used to link to a specific heading on a page. For example:

<h1 id="main-title">Tutor Joes Computer Education</h1>

Example

<html>
  <head>
    <title>Heading Tags</title>
  </head>
  <body>
    <h1>Heading Level 1</h1>
    <h2>Heading Level 2</h2>
    <h3>Heading Level 3</h3>
    <h4>Heading Level 4</h4>
    <h5>Heading Level 5</h5>
    <h6>Heading Level 6</h6>
  </body>
</html>
To download raw file Click Here