News & UpdatesProgrammingWeb programming Store My Projects

HTML Tutorial – 08 – Horizontal Rule

The horizontal rule is used to visually separate sections of a document. To adjust it there are four deprecated attributes – size, width, noshade and align – as well as the color attribute which is not supported in all browsers.


The standard rule is drawn across the full width of the page. For adjusting the length there is the deprecated width attribute, specified in either pixels or percentage.

<hr width="75%">

Normally, browsers render the rule two pixels thick. This can be changed with the deprecated size attribute to a specific number of pixels.

<hr width="75%" size="20">

The horizontal rule in most browsers consists of two gray shades and the fill color will be the same as the background. If the deprecated noshade attribute is added, the entire rule will instead be displayed in one solid color. This attribute does not require a value, although the attribute’s own name can be used as its value (which is required in XHTML).

<hr noshade="noshade">

The color attribute changes the color of the rule. However, this attribute is not part of any HTML standard.

<hr color="red">

The rule can be aligned to the left, right or center, which is the default.

<hr width="75%" align="right">
Recommended additional reading:
Sams - Teach Yourself HTML and CSS in 24 Hours