Advertisement

HTML <hr> tag

Examples

Separated by a horizontal line and paragraph headings:

<h1>This is header 1</h1>
<hr />
<p>This is some text</p>

Try it yourself

Browser Support

IE Firefox Chrome Safari Opera

All major browsers support <hr> tag.

Definition and Usage

<Hr> tag creates a horizontal line in an HTML page.

Horizontal dividing line (horizontal rule) can be visually divided into various parts of the document.

Differences between HTML and XHTML

In HTML, <hr> tag has no end tag.

In XHTML, <hr> must be properly closed, such as <hr />.

In HTML 4.01, all the presentation attribute hr element is not in favor of use.

In XHTML 1.0 Strict DTD, all elements of the presentation attribute hr are not supported.

Optional attributes

Attributes value description
align
  • center
  • left
  • right

Deprecated. Use styles instead.

Predetermined alignment hr elements.

noshade noshade

Deprecated. Use styles instead.

Predetermined color hr element is rendered as a solid color.

size pixels

Deprecated. Use styles instead.

Hr element of predetermined height (thickness).

width
  • pixels
  • %

Deprecated. Use styles instead.

Predetermined width hr element.

Global Properties

<hr> tag supports HTML in the global properties .

Event Properties

<hr> tag supports HTML in the event properties .

Examples TIY

Level
How to insert a horizontal line.