Skip to content
Related Articles

Related Articles

Improve Article
HTML | <hr> align Attribute
  • Last Updated : 05 May, 2021

The HTML <hr> align Attribute is used to specify the alignment of the horizontal line. If the width attribute is not set to 100% then the align attribute will not create any effect.
Syntax: 
 

<hr align="left | center | right">

Attribute Values: 
 

  • left: It sets the left-align to horizontal line.
  • center: It sets the center-align to horizontal line. It is the default value.
  • right: It sets the right-align to horizontal line.

Note: The <hr> align Attribute is not supported by HTML 5.
Example: 
 

html




<!DOCTYPE html>
<html>
 
<head>
    <style>
        h1,h2
        {
            text-align:center;
        }
        h4
        {
            font-weight:bold;
        }
        .gfg
        {
           text-align:right;
            font-weiht:bold;
        }
        .gfg2
        {
            font-weight:bold;
            text-align:center;
        }
    </style>
</head>
 
<body>
     
    <h1>GeeksforGeeks</h1>
    <h2>
        HTML hr align Attribute
 
    </h2>
    <h4>
        hr align="left"
    </h4>
    <hr width="300px;"
        size="10"
        align="left">
    <h4 class="gfg">
        hr align="right"
    </h4>
    <hr width="50%" align="right"
        size="10">
        <h4 class="gfg2">
           hr align="center"       
        </h4>
     
    <hr width="50%"
        size="10"
        align="center">
</body>
 
</html>

Output: 



 

Supported Browsers: The browser supported by HTML <hr> align Attribute are listed below: 
 

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

 




My Personal Notes arrow_drop_up
Recommended Articles
Page :