SolutionsCase StudiesAI ToolsResourcesAboutContact
Get Your Free AI Automation Audit Book a Free 30-Minute Strategy Call
Playground~/frontend Open editor

~/css/dividers

7 CSS Dividers

7 Pure CSSPublished 2026-10-05Free · no sign-up

Seven dividers: a label with a line filling the rest of the row, a line that fades at both ends, a book-style ornament break, dotted, dashed and wavy patterns, a divider with an icon badge, vertical separators between inline items and the three-asterisk section break.

01. Divider with a Left Label

DividerLabel

A section divider with a small label at the start and a line filling the rest of the row, made with flexbox and a pseudo-element that grows. The label is a real heading, so the divider also structures the page.

View code
<h3 class="dv1">Recent orders</h3>
.dv1 { display: flex; align-items: center; gap: 12px; width: 360px; max-width: 100%; margin: 0; color: #475467; font: 700 12px Inter, system-ui, sans-serif; text-transform: uppercase; letter-spacing: .08em; }
.dv1::after { content: ""; flex: 1; height: 1px; background: #d0d5dd; }

02. Fading Gradient Line

DividerGradient

An hr styled as a line that fades out at both ends, softer than a hard rule. The hr keeps its meaning as a thematic break for screen readers, and the gradient is its background with the default border removed.

View code
<div class="dv2"><p>First topic ends here.</p><hr><p>Next topic starts.</p></div>
.dv2 { width: 340px; max-width: 100%; color: #cbd5e1; font: 14px Inter, system-ui, sans-serif; }
.dv2 p { margin: 0; }
.dv2 hr { height: 1px; margin: 18px 0; border: 0; background: linear-gradient(90deg, transparent, #94a3b8, transparent); }

03. Ornament in the Middle

DividerOrnament

A classic book-style break: two short lines with a small dot ornament between them. The lines are the hr's ::before and ::after and the dot is its background, so the markup stays a single semantic element.

View code
<div class="dv3"><p>The chapter closes with a quiet scene.</p><hr><p>A new chapter begins.</p></div>
.dv3 { width: 340px; max-width: 100%; color: #344054; font: 15px Georgia, serif; text-align: center; }
.dv3 p { margin: 0; }
.dv3 hr { display: flex; align-items: center; width: 220px; max-width: 100%; height: 14px; margin: 18px auto; border: 0; background: radial-gradient(circle, #b54708 0 3px, transparent 3.5px) center / 14px 14px no-repeat; }
.dv3 hr::before, .dv3 hr::after { content: ""; flex: 1; height: 1px; background: #d0d5dd; }
.dv3 hr::before { margin-right: 18px; } .dv3 hr::after { margin-left: 18px; }

04. Dotted, Dashed and Wavy Lines

DividerPattern

Three divider patterns made with repeating gradients instead of border styles, so the dot size and spacing are under your control: round dots, long dashes and a wavy line. Each is an hr with its border removed.

View code
<div class="dv4"><hr class="dots"><hr class="dash"><hr class="wave"></div>
.dv4 { display: grid; gap: 22px; width: 320px; max-width: 100%; }
.dv4 hr { margin: 0; border: 0; }
.dv4 .dots { height: 6px; background: radial-gradient(circle, #a78bfa 2.5px, transparent 3px) 0 0 / 14px 6px repeat-x; }
.dv4 .dash { height: 2px; background: repeating-linear-gradient(90deg, #38bdf8 0 18px, transparent 18px 28px); }
.dv4 .wave { height: 10px; background: radial-gradient(circle at 50% 0, transparent 6px, #f472b6 6px 8px, transparent 8.5px) 0 2px / 20px 10px repeat-x, radial-gradient(circle at 50% 100%, transparent 6px, #f472b6 6px 8px, transparent 8.5px) 10px -3px / 20px 10px repeat-x; }

05. Divider with an Icon Badge

DividerIcon

A divider with a round icon badge in the middle, used between steps or sections of a form. The icon is decorative, and if the divider needs a meaning, such as Optional details below, it goes in visible text beside it.

View code
<div class="dv5"><span aria-hidden="true">✦</span><p>Optional details</p></div>
.dv5 { position: relative; display: grid; justify-items: center; gap: 4px; width: 340px; max-width: 100%; font: 600 13px Inter, system-ui, sans-serif; }
.dv5::before { content: ""; position: absolute; left: 0; right: 0; top: 18px; height: 1px; background: #d0d5dd; }
.dv5 span { position: relative; display: grid; place-items: center; width: 36px; height: 36px; border: 1px solid #d0d5dd; border-radius: 50%; background: #f3f5f9; color: #6941c6; }
.dv5 p { margin: 0; color: #475467; }

06. Vertical Dividers Between Items

DividerInline

Thin vertical lines between inline items such as meta information, drawn as borders on every item except the first with the lobotomised-owl style + selector. They wrap cleanly because each item carries its own separator.

View code
<ul class="dv6"><li>5 min read</li><li>Design</li><li><time datetime="2026-10-02">2 Oct 2026</time></li><li>By Ana</li></ul>
.dv6 { display: flex; flex-wrap: wrap; row-gap: 6px; margin: 0; padding: 0; list-style: none; color: #94a3b8; font: 13px Inter, system-ui, sans-serif; }
.dv6 li + li { margin-left: 12px; padding-left: 12px; border-left: 1px solid #334155; }

07. Asterism Section Break

DividerTypography

The typographer's section break, three spaced asterisks, set as generated content on an hr. Writers use it between scenes; the hr keeps the thematic break meaning while the asterisks are purely visual.

View code
<div class="dv7"><p>…and the door closed behind her.</p><hr><p>Three weeks later, the letter arrived.</p></div>
.dv7 { width: 340px; max-width: 100%; color: #344054; font: 16px/1.6 Georgia, serif; }
.dv7 p { margin: 0; }
.dv7 hr { margin: 18px 0; border: 0; text-align: center; overflow: visible; }
.dv7 hr::after { content: "* * *"; color: #98a2b3; font-size: 18px; letter-spacing: .5em; }

About these CSS Dividers

hr means a change of topic

The <hr> element is a thematic break, announced as a separator. Use it between topics or scenes; use plain CSS borders or pseudo-elements for purely decorative lines.

Style the hr freely

Remove its default border with border: 0, then give it a height and a background, gradient or generated content. It keeps its meaning whatever it looks like.

Patterns from gradients

Repeating radial and linear gradients draw dots, dashes and waves with exact control over size and spacing, which border styles do not offer.

Separators that wrap

For inline lists such as metadata, put the separator on each item after the first with li + li, so the separators follow the items when they wrap.

Frequently asked questions

Should decorative dividers be hidden from screen readers?

Yes. Use a styled div or pseudo-element, or add aria-hidden, when a line is not a real break.

Can an hr be vertical?

It can be styled that way, but for separators between inline items, borders on the items are simpler.

How do I add text in the middle of a divider?

Use a heading or span with flexbox and two pseudo-element lines, as the label demo does.