English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

HTML Reference Manual

HTML Tag Reference

HTML: <hr> align attribute

The use of the <hr> align attribute, the align attribute specifies the alignment of the horizontal line. Note: Unless the width attribute is set to less than100%, otherwise the align attribute is invalid.

 HTML <hr> tag

Online Example

Right-aligned horizontal line:

<hr align="right" width="50%">
<p>This is some text. This is some text. This is some text.</p>/p>
Test to see ‹/›

Browser Compatibility

IEFirefoxOperaChromeSafari

All major browsers support the align attribute.

Definition and Usage

HTML5 The <hr> align attribute is not supported. Please use CSS instead.

In HTML 4.01 The align attribute of the <hr> element is deprecated.

The align attribute specifies the alignment of the horizontal line.

Note: Unless the width attribute is set to less than100%, otherwise the align attribute is invalid.

Compatibility notes

In HTML 4.01 In this case, the align attribute of <hr> is deprecated. Please use CSS instead.

CSS syntax (IE and Opera): <hr style="text-align:right">

CSS syntax (Firefox, Chrome, and Safari): <hr style="margin-right:0">

CSS syntax (cross-browser): <hr style="text-align:right;margin-right:0">

CSS Example: Align <hr> element

In our CSS tutorial, you can find more abouttext-align attributedetails.

Syntax

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

Attribute value

ValueDescription
leftAlign horizontal line to the left.
centerAlign horizontal line to the center (default).
rightAlign horizontal line to the right.
 HTML <hr> tag