Skip to content
Related Articles

Related Articles

Improve Article

How to define an HTML heading in HTML5 ?

  • Last Updated : 24 Mar, 2021

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:

Attention reader! Don’t stop learning now. Get hold of all the important HTML concepts with the Web Design for Beginners | HTML  course.




My Personal Notes arrow_drop_up
Recommended Articles
Page :