Divider
Logical hairline rule. Paints via border-block-start so the
stroke aligns with the inline axis under any writing mode. Ships three
variants: horizontal (default), vertical (.is-vertical), and
text-flanked (.has-text, two flanking rules around a centred
label).
Live
Horizontal divider
Section above
Section below
<div>
<p style="margin: 0;">Section above</p>
<hr class="divider">
<p style="margin: 0;">Section below</p>
</div> @use '@adnap/krysalicss' with (
$feature-list: ('base-reset', 'base-global', 'element-divider')
); Vertical divider inside a flex row
Inbox
Drafts
Sent
<div style="display: flex; align-items: center; gap: 0.75rem;">
<span>Inbox</span>
<span class="divider is-vertical"></span>
<span>Drafts</span>
<span class="divider is-vertical"></span>
<span>Sent</span>
</div> @use '@adnap/krysalicss' with (
$feature-list: ('base-reset', 'base-global', 'element-divider')
); Text-flanked divider
or continue with
<div class="divider has-text">or continue with</div> @use '@adnap/krysalicss' with (
$feature-list: ('base-reset', 'base-global', 'element-divider')
); Markup
<!-- Horizontal hairline. Logical border-block-start so vertical writing modes flip the axis. -->
<hr class="divider">
<!-- Vertical rule. Stretches to parent block-axis height inside a flex/grid row. -->
<div style="display: flex; align-items: center; gap: 0.5rem;">
<span>Inbox</span>
<span class="divider is-vertical"></span>
<span>Drafts</span>
</div>
<!-- Text-flanked rule for labelled section breaks. -->
<div class="divider has-text">or continue with</div> Variants
- Horizontal (default).
<hr class="divider">or any block element with the class. Paintsborder-block-start; the element's ownblock-sizeis zero so the rule is the only visible bit. .is-vertical. Flips toinline-blockwith aninline-startstroke. Usesalign-self: stretchto match the parent's block-axis height under flex or grid; falls back to a 1em minimum height when standalone..has-text. Becomes a flex container with two pseudo-element rules (::before/::after) flanking a centred label. Use for labelled section breaks ("or continue with", "since 2024", etc.).
Accessibility
- The default rule renders without a visible label; pair with
<hr>so the separator carries semantic weight for assistive tech. On a generic<div class="divider">, addrole="separator"(andaria-orientation="vertical"for.is-vertical) if the rule conveys structural meaning. - Under
forced-colors: activethecolor-mixstroke collapses to near-transparent; the plugin overridesborder-color: CanvasTextso the rule stays visible (WCAG 1.4.11).
Variables
| Variable | Default | Notes |
|---|---|---|
$selector | '.divider' | Re-scope freely. |
$vertical-selector | '.is-vertical' | Modifier flipping to an inline-start rule. |
$has-text-selector | '.has-text' | Modifier turning the rule into a flex flanker around a label. |
$thickness | $global-border-width (1px) | Stroke thickness. |
$gap | $global-gap (1rem) | Block margin (horizontal) / inline margin (vertical). |
$color-mix | 50% | Stroke tint. 50% currentColor over transparent clears WCAG 1.4.11 (3:1 non-text) on both default and dark themes. |
$text-line-gap | $size-small (0.75rem) | Inline gap between the flanking rules and the centred label in .has-text. |
$vertical-min-height | 1em | Fallback height for a standalone .is-vertical with no stretching parent. |
Override example
@use '@adnap/krysalicss/element/divider' with (
$thickness: 2px,
$gap: 2rem,
$color-mix: 30%,
); Tokens consumed
| Token | Used for |
|---|---|
--kc-fg | Stroke base colour, mixed against transparent at $color-mix alpha. Falls back to currentColor. |