<hr> Tag in HTML

Quick facts

CategoryFlow content
Content modelEmpty — it’s a void element with no children
Tag omissionVoid element — no end tag, ever
Permitted parentsAny element that accepts flow content
DOM interfaceHTMLHRElement

Syntax

<hr>

Live example

Edit the code below and watch the preview update instantly.

index.html
Preview

Attributes

AttributeDescription
—Presentational attributes like size, width, and noshade are deprecated — style the line with CSS instead. Only the global attributes apply.

Common examples

A change of topic

Use <hr> where the subject shifts but a new heading isn’t needed, like a scene break in a story.

<p>…and that was the end of the long journey.</p> <hr> <p>Three years later, a letter arrived.</p>

A subtle styled divider

Remove the default 3D border and draw a clean, thin line instead.

<style> hr { border: none; border-top: 1px solid #ddd; margin: 2rem 0; } </style>

A decorative ornament

A pseudo-element can turn the line into centred stars, a classic book-style break.

<style> hr.stars { border: none; text-align: center; } hr.stars::after { content: "* * *"; letter-spacing: 1em; color: #999; } </style> <hr class="stars">

Separators in a select menu

Modern browsers allow <hr> inside <select> to separate groups of options.

<select> <option>Recent file 1</option> <option>Recent file 2</option> <hr> <option>Open…</option> </select>

<hr> vs a CSS border

<hr> means “a thematic break” — the content after it is a new topic or scene. Screen readers announce it as a separator, so it carries meaning. A CSS border-bottom on a heading or section is purely visual and isn’t announced.

The rule: if the line marks a real change of topic, use <hr> and style it as you like. If the line is only decoration — under a heading, between cards, around a box — use CSS borders.

<hr>CSS border
MeaningThematic breakNone (decoration)
Screen readersAnnounced as a separatorNot announced
Best forTopic or scene changesVisual lines

Common mistakes to avoid

  • Using <hr> for spacing. Use CSS margin to add space between sections.
  • An <hr> before every heading. Headings already start a new section; adding a line before each one is redundant.
  • Old presentational attributes. size, width, noshade and color are obsolete; use CSS.
  • Writing </hr>. It’s a void element: write <hr> (or <hr />), never with a closing tag.

Accessibility & SEO tips

  • Give styled lines enough contrast to be seen, but don’t rely on them alone to separate topics — a heading is clearer.
  • For purely decorative lines, use CSS so screen reader users don’t hear meaningless “separator” announcements.
  • Search engines treat <hr> as a minor structural hint; headings matter far more for SEO.
  • In long articles, prefer a new heading over an <hr> when the new part has a clear topic — headings help readers and search engines more than lines do.

Browser support

Supported in every browser, including Chrome, Edge, Firefox, Safari and their mobile versions — it has been part of HTML since the very first versions. Using


inside