HTML <hr> alignAttribute

HTML hr 标签参考手册HTML <hr> Tag

Examples

A left-aligned horizontal line:

<p>This is some text. This is some text. This is some text.</p>

<hr align="left" width="50%">

Try it Yourself »

Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the align attribute.


Definition and Usage

HTML5 does not support the <hr> align attribute. Use CSS instead.

In HTML 4.01, the align attribute of <hr>is deprecated。

The align attribute specifies the alignment of a horizontal line.

Note:Unless the width attribute is set to less than 100%, the align attribute will have no effect.


Compatibility Notes

In HTML 4.01, the align attribute of <hr> is deprecated. 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 the <hr> element

In our CSS tutorial, you can find more details aboutthe text-align property.


Syntax

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

Attribute Values

Value Description
left Left-aligns the horizontal line.
center Center-aligns the horizontal line (default value).
right Right-aligns the horizontal line.


HTML hr 标签参考手册HTML <hr> Tag Other Extensions