Skip to content
Related Articles

Related Articles

How to define an HTML heading in HTML5 ?

View Discussion
Improve Article
Save Article
  • Last Updated : 24 Mar, 2021
View Discussion
Improve Article
Save Article

An HTML heading tag is used to define headings of a page. Headings are defined with the <h1> to <h6> tags. The size of the text depends upon the type of heading tag. h1 is the largest heading tag and h6 is the smallest one (h1 > h2 > h3 > h4 > h5 > h6).

Syntax:

<h1></h1>
<h2></h2>
<h6></h6>

Example 1:

HTML




<!DOCTYPE html>
<html>
    
<body>
  <h1>Welcome to GeeksforGeeks </h1>
  <h2>A computer science portal for geeks</h2>
  <h5>Tutorial</h5>
  <h6>Geeks</h6>
</body>
    
</html>

Output:

Example 2: Each HTML heading has a default size, but user can change its size as given below.

HTML




<!DOCTYPE html> 
<html
  
<body
  <h1 style="font-size:40px;">
     Welcome to GeeksforGeeks
  </h1
</body
    
</html>

Output:

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!