HTML Heading


In this tutorial, we will learn about HTML Heading and how to apply it using examples.

An HTML heading tag is used to specify a page's header. HTML defines six different levels of headers. H1, H2, H3, H4, H5, and H6 are the six heading elements, with H1 being the highest level and H6 being the lowest.

Syntax

The Importance of the Heading:

  • Headings are used by search engines to index the structure and content of a webpage.
  • Headings are used to draw attention to significant subjects.
  • They give useful information and enlighten us about the document's structure.

Example

Preview

Changing the size of HTML Headings

The style property can be used to adjust the default size of HTML headers.

Example

Preview

Horizontal rule

In an HTML page, the <hr> element, which stands for horizontal rule, is used to indicate a theme break. The <hr> tag is an empty tag that does not need to be followed by an end tag. It is mostly used to divide material. For more information, please see the HTML <hr> Tag article.

Example

Preview

FAQs

Yes, headings can be styled with CSS. You can change the font size, font family, color, and other properties of headings using CSS. Although you will learn all this in CSS later, it is important to know about it at the moment. For example, you can use the font-size property to make a heading larger or smaller, or the color property to change its color. Additionally, you can use CSS to adjust the spacing around headings, add borders or background colors, and more. 

To create a table of contents using headings in HTML, you can use the "id" attribute to assign a unique ID to each heading, and then create links to those IDs in your table of contents.

The heading tags in HTML are used to define headings and subheadings on a webpage, which help to structure the content and make it easier to read and understand.