Skip to main contentSkip to docs navigation

Vertical rule

A vertical divider element that mirrors the behavior of <hr>, scaling naturally in flex layouts.

On this page
@layer helpers

.vr produces a vertical line styled after the <hr> element. The element is 1px wide with a min-height of 1em. Its color is controlled by the $vr-color and $vr-opacity Sass variables.

Example

Apply .vr as a bare inline element:

HTML
<div class="vr"></div>

Inside a flex container, .vr stretches to match the container's height:

HTML
<div class="d-flex" style="height: 200px;">
  <div class="vr"></div>
</div>

With stacks

.vr integrates naturally with stacks as a visual separator:

First item
Second item
Third item
HTML
<div class="hstack gap-medium">
  <div class="p-xsmall">First item</div>
  <div class="p-xsmall ms-auto">Second item</div>
  <div class="vr"></div>
  <div class="p-xsmall">Third item</div>
</div>

CSS

.vr has no CSS custom properties; width, color, and opacity are set at compile time via Sass variables.

.vr {
  display: inline-block;
  align-self: stretch;
  width: $vr-size;
  min-height: 1em;
  background-color: $vr-color;
  opacity: $vr-opacity;
}

Sass variables

Customize the vertical rule Sass variables to adjust its width, color, and opacity.

$vr-size:                   $hr-size;
$vr-color:                  $hr-color;
$vr-opacity:                $hr-opacity;