HTML Headings - GeeksforGeeks

HTML Headings

Last Updated : 15 May, 2024
Improve
Improve
Like Article
Like
Save
Share
Report

HTML headings, from <h1> to <h6>, indicate content hierarchy and importance. Search engines use them for indexing. Users navigate by headings. Employ <h1> for main titles, <h2> for subsections, and progressively lower levels for less important content to maintain structure and readability.

HTML provides six levels of heading elements, ranging from <h1> (highest level) to <h6> (lowest level).

Purpose and Usage of Heading Tags:

1. <h1> – Main Heading (Largest):

  • Represents the primary topic of the page.
  • Use it sparingly to maintain clarity.

2. <h2> – Subheadings:

  • Ideal for dividing content into sections.
  • If further subsections exist, employ <h3> elements.

3. <h3> to <h6> – Smaller Headings:

  • Gradually decrease in size.
  • Use them for finer subdivisions.

Screenshot-2023-12-17-130848

Syntax:

// the 'h' inside the tag should be in small case only.
<h1>Heading1</h1>
<h2>Heading2</h2>
.
.
.
<h6>Heading6</h6>

Why Do Headings are Important?

1. SEO Impact:

  • Search engines index headings to understand content structure.
  • Well-organized headings enhance visibility and ranking.

2. Highlighting Key Topics:

  • Headings emphasize essential information.
  • Readers quickly grasp the document’s structure.

Example: In this example illustrates the HTML heading tags.

HTML
<!DOCTYPE html>
<html>

<body>
    <h1>This is heading h1</h1>
    <h2>This is heading h2</h2>
    <h3>This is heading h3</h3>
    <h4>This is heading h4</h4>
    <h5>This is heading h5</h5>
    <h6>This is heading h6</h6>
</body>

</html>

Output:

HTML Headings

Customization in HTML Heading Tags

The default size of HTML headings can be changed, using the style attribute.

Example: In this example explains the HTML heading tags by specifying the size of the font.

HTML
<!DOCTYPE html>
<html>

<body>

    <h1>H1 Heading</h1>

    <!-- With the help of Style attribute you can customize
           the size of the heading, As done below-->

    <h1 style="font-size: 50px">H1 with new size.</h1>

    <!-- Here font-size is the property by which  we can 
           modify the heading. Here we kept it 50px i.e. 50 pixels -->

</body>

</html>

Output:

HTML Headings

HTML Headings Example Output

Supported Browsers: 


Previous Article
Next Article

Similar Reads

Blaze UI Headings Extra Small
Blaze UI is a free open source UI Toolkit that provides a great structure for building websites quickly with a scalable and maintainable foundation. All components in Blaze UI are developed mobile-first and rely solely on native browser features, not a separate library or framework. It helps us to create a scalable and responsive website fast and e
2 min read
Blaze UI Headings Large
Blaze UI is a free open source UI Toolkit that provides a great structure for building websites quickly with a scalable and maintainable foundation. All components in Blaze UI are developed mobile-first and rely solely on native browser features, not a separate library or framework. It helps us to create a scalable and responsive website fast and e
2 min read
Blaze UI Headings Medium
Blaze UI is a free open source UI Toolkit that provides a great structure for building websites quickly with a scalable and maintainable foundation. All components in Blaze UI are developed mobile-first and rely solely on native browser features, not a separate library or framework. It helps us to create a scalable and responsive website fast and e
2 min read
Blaze UI Headings Small
Blaze UI is a free open source UI Toolkit that provides a great structure for building websites quickly with a scalable and maintainable foundation. All components in Blaze UI are developed mobile-first and rely solely on native browser features, not a separate library or framework. It helps us to create a scalable and responsive website fast and e
2 min read
Blaze UI Headings Super
Blaze UI is a free open source UI Toolkit that provides a great structure for building websites quickly with a scalable and maintainable foundation. All components in Blaze UI are developed mobile-first and rely solely on native browser features, not a separate library or framework. It helps us to create a scalable and responsive website fast and e
2 min read
Blaze UI Headings Extra Large
Blaze UI is a free open source UI Toolkit that provides a great structure for building websites quickly with a scalable and maintainable foundation. All components in Blaze UI are developed mobile-first and rely solely on native browser features, not a separate library or framework. It helps us to create a scalable and responsive website fast and e
2 min read
Blaze UI Headings
Blaze UI is a free open-source UI Toolkit that provides a great structure for building websites quickly with a scalable and maintainable foundation. All components in Blaze UI are developed mobile-first and rely solely on native browser features, not a separate library or framework. It helps us to create a scalable and responsive website fast and e
2 min read
React.js Blueprint Typography Headings
BlueprintJS is a React-based UI toolkit for the web. This library is very optimized and popular for building interfaces that are complex data-dense for desktop applications. Typography is used to present components efficiently. There are different ways to design typography. Typography Headings are used to present headings on the web page. It can al
3 min read
Bootstrap 5 Badge Headings
Badge headings can be used to label the latest information about the headings. The size of badges scales in accordance with the heading size. It just matches the size of the parent element (uses relative units). So, you can directly use the badge class inside any tag (like span) whose parent is the heading tag. If you want any specific color for th
2 min read
BootStrap 5 Typography Customizing Headings
Bootstrap 5 Typography Customizing headings is used to customize the heading without using HTML tags and CSS classes. Use the .text-muted class with &lt;small&gt; tag. Typography Customizing headings used tag: small: It is used to create secondary subheadings. Typography Customizing headings used classes: text-muted: It is used for text color, text
2 min read