Home / Snippets / Color & Theming /
Dark mode borders and dividers
Stacked rows separated by a gradient hr and a nested block using an inset ring instead of a second border pass.
Section
AccountSection
Billing
Inset panel — uses inner ring, not a second card.
Widely Supported
Quick implementation
hr.dm-bd-divider {
border: 0;
height: 1px;
background: linear-gradient(90deg, transparent, oklch(0.45 0.04 265 / 0.55), transparent);
}
.dm-bd-inset {
box-shadow: inset 0 0 0 1px oklch(0.38 0.04 265 / 0.35);
border-radius: var(--radius);
}
Prompt this to your LLM
Dividers vs borders, lists, and density.
You are styling separators in a dark dashboard.
Goal: Use semantic hr for section breaks and inset rings for nested fields without doubling card borders.
Technical constraints:
- Dividers must stay visible on charcoal backgrounds — use oklch mid tones, not near-black on near-black.
- Prefer gradient hairlines for full-width rules; avoid 1px #333-style hex.
- Inset panels use box-shadow inset, not an extra wrapper with border (fewer DOM nodes).
- Respect prefers-contrast: increase alpha on divider stops if needed.
Framework variant A: HTML + CSS.
Framework variant B: React list — map items; render <hr /> between, not inside <li> for validity.
Edge cases:
- Last row should not show a trailing divider — handle in component logic.
- Screen readers: hr announces a separator — use sparingly inside dialogs.
- RTL: gradient direction may need logical properties in global styles.
Return HTML + CSS.
Why this matters in 2026
Dark UIs fail when every block uses the same 1px gray. Hairline gradients and inset rings separate content without the “floating white box” problem.
The logic
A gradient hr fades at the edges so the rule does not fight the card radius. Inset shadow simulates a recessed field while keeping one outer border on the shell.
Accessibility & performance
Use real hr between thematic sections. Too many rules can create noise for screen reader users — pair with clear headings. No expensive filters.