You are here:    Home » HTML 4.0 Reference

The Web Design Group

HR - Horizontal Rule

Syntax <HR>
Attribute Specifications
Contents Empty
Contained in APPLET, BLOCKQUOTE, BODY, BUTTON, CENTER, DD, DEL, DIV, FIELDSET, FORM, IFRAME, INS, LI, MAP, NOFRAMES, NOSCRIPT, OBJECT, TD, TH

The HR element defines a horizontal rule for visual browsers. While this element is inherently presentational, it can be used structurally as a section divider. However, for greater flexibility the HR element can be replaced with the border-bottom or border-top properties of Cascading Style Sheets. For example, the following style rule would suggest a horizontal line above all DIV elements with CLASS=navbar:

div.navbar { border-top: solid medium navy }

HR's deprecated ALIGN attribute suggests the horizontal alignment of the line. Possible values are left, right, and center. The deprecated WIDTH attribute specifies the width of the line as a percentage or a number of pixels. If a width is specified, percentages are generally preferred since they adjust to varying window sizes. The width property of Cascading Style Sheets provides greater flexibility in suggesting the width of horizontal rules.

The boolean NOSHADE attribute suggests that the rule be rendered as a solid line rather than the groove style commonly used. The SIZE attribute suggests the height of the line in pixels. These attributes are both deprecated in favor of style sheets.

More Information