Skip to content

Divider

Edit on GitHub

A horizontal or vertical line used to separate content sections.

@volvo-cars/css v3.3.1

Use a classless <hr /> for the default 1px divider with standard vertical spacing and the primary ornament color.

Content above the divider.


Content below the divider.

Show codeHide code
<p>Content above the divider.</p>
<hr />
<p>Content below the divider.</p>

Adding any class to <hr> removes the default styles. Rebuild with utility classes: border-t for the line, my-* for spacing, and optional width or color classes.

Use w-sm mx-auto for a short centered divider, or border color utilities like border-primary or border-secondary to change the line color.

Use border-l on a <div> with role="separator" and aria-orientation="vertical". The parent must have a defined height.

  • A plain <hr /> has an implicit separator role. No extra attributes needed
  • For vertical dividers, add role="separator" and aria-orientation="vertical" since <div> has no semantic meaning
  • Decorative dividers that don’t convey structure can use role="presentation" to hide them from assistive technology
Selector or class Description
hr:not([class]) Default divider: 1px top border with --v-space-32 margin above and below
border-t Horizontal line on an <hr> with a class
border-l Vertical line on a <div role="separator">
my-* Vertical spacing around a horizontal divider
w-sm, mx-auto Short, centered divider
border-primary Primary border color
border-secondary Secondary border color
Attribute Description
role="separator" Required on a <div> divider. An <hr> has this role implicitly
aria-orientation="vertical" Marks a vertical divider
role="presentation" Hides a decorative divider from assistive technology
Custom property Description
--v-space-32 Vertical margin of the default <hr>, set by the base styles