HTML | <hr> Tag

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:

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:



filter_none

edit
close

play_arrow

link
brightness_4
code

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

chevron_right


Output:

Example 2:

filter_none

edit
close

play_arrow

link
brightness_4
code

<!DOCTYPE html>
<html>
    <head>
        <title>hr tag with attributes</title>
    </head>
    <body>
        <p>Normal horizontal line.</p>
        <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>

chevron_right


Output:

Browser Support:

  • Apple Safari 1+
  • Google Chrome 1+
  • Firefox 1+
  • Opera 4+
  • Internet Explorer 2+


My Personal Notes arrow_drop_up

I am a technology enthusiast who has a keen interest in programming I am pursuing Engineering in Computer Science from GEU, Dehradun I like to unwind by watching movies and English sitcomsI have a keen interest in music

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.




Article Tags :
Practice Tags :


Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.