Open In App
Related Articles

HTML <hr> Tag

Improve Article
Improve
Save Article
Save
Like Article
Like

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. These attributes are not supported in HTML5:
 

Attribute Value Description
align left center right Used to specify the alignment of the horizontal rule.
noshade noshade Used to specify the bar without shading effect.
size pixels Used to specify the height of the horizontal rule.
width pixels Used to specify the width of the horizontal rule.

Syntax : 
 

<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: 
 

image widget

Supported Browsers: 

  • Google Chrome 1
  • Edge 12
  • Internet Explorer 5.5
  • Firefox 1
  • Opera 12.1
  • Safari 3

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.


Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now!

Last Updated : 22 Jul, 2022
Like Article
Save Article
Previous
Next
Similar Reads
Complete Tutorials