× Introduction HTML Editors Web Components Headings Paragraph Attributes Entities Images Comments Formatting Links File Paths Book Marks Image Links Unordered Lists Ordered Lists Tables Forms Other Form Elements Semantic tags Media Div and Span Examples Projects eBooks









HTML5 Headings

In this tutorial you will learn how to create headings in HTML.

Organizing Content with Headings

Headings help in defining the hierarchy and the structure of the web page content.

HTML offers six levels of heading tags, <h1> through <h6> the lower the heading level number, the greater its importance — therefore <h1> tag defines the most important heading, whereas the <h6> tag defines the least important heading in the document.

By default, browsers display headings in larger and bolder font than normal text. Also, <h1> headings are displayed in largest font, whereas <h6> headings are displayed in smallest font.

Using Headings

Headings can be used to describe the topic they precede and they are defined with the <h1> to <h6> tags. Headings support all the global attributes.

  • <h1> defines the most important heading.
  • <h6> defines the least important heading.

Defining a heading:

  • <h1>Heading 1</h1>
  • <h2>Heading 2</h2>
  • <h3>Heading 3</h3>
  • <h4>Heading 4</h4>
  • <h5>Heading 5</h5>
  • <h6>Heading 6</h6>

Importance of Headings

  • HTML headings provide valuable information by highlighting important topics and the structure of the document, so optimize them carefully to improve user engagement.
  • Don't use headings to make your text look BIG or bold. Use them only for highlighting the heading of your document and to show the document structure.
  • Since search engines, such as Google, use headings to index the structure and content of the web pages so use them very wisely in your webpage.
  • Use the <h1> headings as main headings of your web page, followed by the <h2> headings, then the less important <h3> headings, and so on.

Example document:   Try It

  
 <!doctype html>
 <html>
   <head>
     <meta charset="utf-8">
     <title>HTML5 headings demo </title>
   </head>
   <body>    
    <h1>Heading 1</h1>
    <h2>Heading 2</h2>
    <h3>Heading 3</h3>
    <h4>Heading 4</h4>
    <h5>Heading 5</h5>
    <h6>Heading 6</h6>
   </body>
 </html>

Practice exercise:

1.Write html code to display as follows. View

Electronic Computer

Classification of Computers

Evolution of Computers

2.Write html code to display as follows. view

Programming Languages

Machine Language (1st Generation)

Assempbly Language (2nd Generation)

High level Language (3rd Generation)

Query Language (4rth Generation)

Voice Input Language (5th Generation)