Name

hr — HTML 4.01 | HTML5

Synopsis

HTML: <hr>; XHTML: <hr/> or <hr />

Adds a horizontal rule to the page that can be used as a divider between sections of content. It is a block-level element.

Notes

This is an example of a presentational HTML element. In HTML5, this element is included but has been redefined as a “paragraph-level thematic break.” Developers who want a purely decorative horizontal rule should opt for using style sheets to add a border on the top or bottom edge of a block element.

Start/End Tags

This is an empty element. In HTML, the end tag is forbidden. In XHTML, the element must be closed with a trailing slash as just shown. Developers may include a space character before the slash for backward compatibility with older browsers.

Attributes

Core, Internationalization, Events, HTML5 Global Attributes

align="center|left|right"

Deprecated. Not in HTML5. If the rule is shorter than the width of the window, this attribute controls horizontal alignment of the rule. The default is center.

noshade (noshade="noshade" in XHTML)

Deprecated. Not in HTML5. Displays the rule as a solid bar with no shading.

size="number"

Deprecated. Not in HTML5. Specifies the thickness of the rule in pixels.

width="number" or "number%"

Deprecated. Not in HTML5. Specifies the length of the rule in pixels or as a percentage of the page width. By default, rules are the full width of the browser window.

Example (HTML)

<p>These are notes from Thursday.</p>
<hr>
<p>These are notes from Friday.</p>

Example (XHTML)

<p>These ...

Get HTML & XHTML Pocket Reference, 4th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.