The <hr> element
The <hr> tag draws a horizontal rule — a thematic break between paragraphs, such as a shift in topic within a story or a scene change. Visually it renders as a horizontal line, but semantically it signals a break in content, not just a decorative divider.
Last updated: October 3, 2026
Quick facts
| Category | Flow content |
| Content model | Empty — it’s a void element with no children |
| Tag omission | Void element — no end tag, ever |
| Permitted parents | Any element that accepts flow content |
| DOM interface | HTMLHRElement |
Syntax
Live example
Edit the code below and watch the preview update instantly.
Attributes
| Attribute | Description |
|---|---|
| — | 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.
A subtle styled divider
Remove the default 3D border and draw a clean, thin line instead.
A decorative ornament
A pseudo-element can turn the line into centred stars, a classic book-style break.
Separators in a select menu
Modern browsers allow <hr> inside <select> to separate groups of options.
<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 | |
|---|---|---|
| Meaning | Thematic break | None (decoration) |
| Screen readers | Announced as a separator | Not announced |
| Best for | Topic or scene changes | Visual lines |
Common mistakes to avoid
- Using
<hr>for spacing. Use CSSmarginto 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,noshadeandcolorare 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