Horizontal Rules

Horizontal rules give you a way to separate sections of your document visually. That way, you give readers a clean, consistent, visual indication that one portion of your document has ended and another portion has begun. Horizontal rules effectively set off small sections of text, delimit document headers and footers, and provide extra visual punch to headings within your document.

The <hr> Tag

The <hr> tag tells the browser to insert a horizontal rule across the display window. With HTML, it has no end tag. For XHTML, include the end-tag slash (/) symbol as the last character in the tag itself after any attributes (<hr .../>), or include an end tag immediately following (<hr></hr>).

Like the <br> tag, <hr> forces a simple line break. Unlike <br>, <hr> causes the paragraph alignment to revert to the default (left justified). The browser places the rule immediately below the current line, and content flow resumes below the rule. [<br>, 4.6.1]

The browser decides how to render a horizontal rule. Typically, the rule extends across the entire document. Graphical browsers also may render it with a chiseled or embossed effect; ...

Get HTML & XHTML: The Definitive Guide, 6th 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.