hr tag In HTML5

hr tag In HTML5

Published By
1 min read
Rajdeep Singh
html

The HTML <hr> element represents a horizontal Rule or a Create a Page break Between Tow Element on html page.

The <hr> tag is an empty tag and it does not require an end tag.

Syntax

<hr>

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.

Example 1

<html> 
    <head> 
        <title>HTML hr tag</title> 
    </head> 
    <body> 
        <p>horizontal First Element after this  paragraph.</p> 
        <hr> 
        <p>horizontal Second Element before End here</p> 
	<hr>
  	<p>horizontal Three Element before End here</p> 
    </body> 
</html>

Example 2

<html> 
    <head> 
        <title>HTML hr tag with attributes</title> 
    </head> 
    <body> 
        <p>horizontal First Normal Element</p> 
        <hr>     
        <p>horizontal Second Element with height of 20 pixels</p> 
        <hr size="20"> 
           
        <p>horizontal Third Element with height of 30 pixels and noshade.</p> 
        <hr size="20" noshade> 
    </body> 
</html>

Example 3

<html> 
    <head> 
        <title>HTML hr Style</title> 
    </head> 
    <body> 
        <p>horizontal First Normal Element</p> 
        <hr style="height:30px">     
       
	<p>horizontal Second Element With Style</p> 
        <hr style="height:30%"> 
           
        <p>horizontal third Element With Style</p> 
        <hr style="width:300px"> 
    </body> 
</html>