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.
Note: The <hr> align Attribute is not supported by HTML5.
Syntax:
<hr align="left | center | right">Attribute Values:
Attribute Values | Description |
|---|---|
left | It sets the left alignment to the horizontal line. |
center | It sets the center-align to the horizontal line. It is the default value. |
right | It sets the right alignment to the horizontal line. |
Example: In this example, we will see the implementation of hr align attribute tag with an example.
<!DOCTYPE html>
<html>
<head>
<style>
h1,
h2 {
text-align: center;
}
h4 {
font-weight: bold;
}
.gfg {
text-align: right;
font-weight: 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:
- Google Chrome 1
- Edge 12
- Firefox 1
- Safari 12.1
- Opera 3