Divider
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.
Show code
<p>Content above the divider.</p><hr /><p>Content below the divider.</p>Custom styling
Section titled “Custom styling”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.
Vertical divider
Section titled “Vertical divider”Use border-l on a <div> with role="separator" and aria-orientation="vertical". The parent must have a defined height.
Accessibility
Section titled “Accessibility”- A plain
<hr />has an implicitseparatorrole. No extra attributes needed - For vertical dividers, add
role="separator"andaria-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
CSS reference
Section titled “CSS reference”| 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 |