Conversation


Your input fuels progress! Share your tips or experiences on prioritizing mental wellness at work. Let's inspire change together!

Join the discussion and share your insights now!

Comments 0


advertisement

Explain the Heading tag in HTML

heading tag in html


Headings

The heading elements define headings for contents such as text and images. They specify a hierarchical structure of a Web page by grouping the contents into different headings.

HTML defines six levels of heading that range from H1 to H6. The H1 element specifies the top-level heading, which is displayed with the largest size. The H6 element specifies the lowest-level heading, which is displayed with the smallest size.

<!DOCTYPE html>

<html>
 <head>
  <title>Headings</title>
 </head>
 <body>
  <h1>H1 Heading</h1>
  <h2>H2 Heading</h2>
  <h3>H3 Heading</h3>
  <h4>H4 Heading</h4>
  <h5>H5 Heading</h5>
  <h6>H6 Heading</h6>
 </body>
</html>


  • The heading under the H1 tags will be displayed with the largest size. Each subsequent heading will be displayed in a size lower than its previous heading.

  • The heading under the H6 tags will be displayed with the lowest size.

HGROUP

The <hgroup> element is a new element defined in HTML5. It is used to group titles and their subtitles. The element is used to group a set of h1-h6 elements. These are used for headings that have multiple levels that can include subheadings, alternative titles, taglines, and so on. The main advantage of using the <hgroup> tag is to create a document outline.

<hgroup>
  <h1>Title</h1>
  <h2>Subtitle</h2>
</hgroup>

HTML heading in HTML basics of heading tag heading tag in html heading tag html tags heading tag in html with example

advertisement