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

HTML reference manual

HTML tag大全

HTML: <hr> width attribute

<hr> width attribute usage, the width attribute specifies the horizontal line width in pixels or percentages, online examples demonstrate how to use the <hr> width attribute, browser compatibility, syntax definition, and detailed information about its attribute values, etc.

 HTML <hr> tag

Online example

Width is68% horizontal line:

<p>Normal hr horizontal line:</p>
<hr>
<p>hr horizontal line width68%:</p>
<hr width="68%">
Test and see ‹/›

Browser Compatibility

IEFirefoxOperaChromeSafari

The width attribute has been deprecated, but it is still supported in all major browsers.

Definition and Usage

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

In HTML 4.01 The <hr> tag's width attribute has been deprecated.

The width attribute specifies the width of the horizontal line in pixels or percentage units.

Compatibility Notes

In HTML 4.01 In version 5, the <hr> tag's width attribute has been deprecated. Please use CSS instead.

CSS Syntax: <hr style="width:50%">

CSS Example: Set the width of <hr> element

In our CSS tutorial, you can find more aboutwidth attributedetails.

Syntax

<hr width="pixels|%">

Attribute Value

ValueDescription
pixelsSpecify the width in pixels (for example "100px" or simply "100").
%Specify the width as a percentage of available space (for example "50%").
 HTML <hr> tag