Skip to content
Related Articles

Related Articles

HTML | Heading
  • Difficulty Level : Basic
  • Last Updated : 17 Jul, 2019

There are six levels of headings defined by HTML. These six heading elements are H1, H2, H3, H4, H5, and H6; with H1 being the highest level and H6 the least.

Importance of Heading :

  1. Search Engines use headings for indexing the structure and content of the webpage.
  2. Headings are used for highlighting important topics.
  3. They provide valuable information and tell us about the structure of the document.

Using headings :




<!DOCTYPE html>
<html>
  
<body>
  
    <h1>H1</h1>
    <h2>H2</h2>
    <h3>H3</h3>
    <h4>H4</h4>
    <h5>H5</h5>
    <h6>H6</h6>
  
</body>
  
</html>


Output :

Changing size of HTML Headings :
The default size of HTML headings can be changed using the style attribute.






<!DOCTYPE html>
<html>
  
<body>
  
    <h1 style="font-size:60px;">H1 with new size.</h1>
  
</body>
  
</html>


Output :

Horizontal rule in HTML :
The “hr” tag which stands for the horizontal rule is used to define a thematic break in an HTML page. It is basically used to separate content.




<!DOCTYPE html>
<html>
  
<body>
  
    <h1>Heading 1</h1>
    <p>I like HTML.</p>
    <hr>
  
    <h2>Heading 2</h2>
    <p>I like CSS.</p>
    <hr>
  
    <h2>Heading 3</h2>
    <p>I like Javascript.</p>
  
</body>
  
</html>


Output :

The head element in HTML :
The HTML head element acts as a container for metadata. Metadata is the data about the HTML document which is not displayed. The head element has nothing to do with headings.
The head element is placed between the “HTML” tag and “body” tag.




<!DOCTYPE html>
<html>
  
<head>
    <title>Basics of HTML</title>
    <meta charset="UTF-8">
</head>
  
<body>
  
    <p>I like HTML.</p>
    <p>HTML is easy to learn.</p>
  
</body>
  
</html>


Output :

Supported Browser: The browser supported by <heading> tag are listed below:

  • Google Chrome
  • Internet Explorer
  • Firefox
  • Opera
  • Safari

full-stack-img

My Personal Notes arrow_drop_up
Recommended Articles
Page :