Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

HTML <hr> Tag

  • Difficulty Level : Basic
  • Last Updated : 30 Jul, 2021

The <hr> tag in HTML stands for horizontal rule and is used to insert a horizontal rule or a thematic break in an HTML page to divide or separate document sections. The <hr> tag is an empty tag, and it does not require an end tag.
Tag Attributes: The table given below describe the <hr> tag attributes:
 

AttributeValueDescription
Alignleft center rightUsed to specify the alignment of the horizontal rule.
noshadenoshadeUsed to specify the bar without shading effect.
sizepixelsUsed to specify the height of the horizontal rule.
widthpixelsUsed to specify the width of the horizontal rule.

Syntax : 
 

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

<hr> ...

Below programs illustrate the <hr> tag in HTML:
Example 1: 
 

HTML




<!DOCTYPE html>
  
<html>
  
    <body>
          
<p>There is a horizontal rule below this paragraph.</p>
  
        <!--HTML hr tag is used here-->
        <hr>
          
<p>This is a horizontal rule above this paragraph.</p>
  
    </body>       
  
</html>                    

Output: 
 



Example 2(hr tag with attributes): 
 

HTML




<!DOCTYPE html>
  
<html>
  
    <body>
        
          
<p>Normal horizontal line.</p>
  
        
        <!--HTML hr tag is used here-->
        <hr>
           
          
<p>Horizontal line with height of 30 pixels</p>
  
        <hr size="30">
           
          
<p>Horizontal line with height of 30 pixels
                                       and noshade.</p>
  
        <hr size="30" noshade> 
        
    </body>
  
</html>                    

Output: 
 

Supported Browsers: 
 

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

 

HTML is the foundation of webpages, is used for webpage development by structuring websites and web apps.You can learn HTML from the ground up by following this HTML Tutorial and HTML Examples.

CSS is the foundation of webpages, is used for webpage development by styling websites and web apps.You can learn CSS from the ground up by following this CSS Tutorial and CSS Examples.




My Personal Notes arrow_drop_up
Recommended Articles
Page :