|
| 1 | +--- |
| 2 | +layout: docs |
| 3 | +title: Dividers |
| 4 | +description: Use the horizontal or vertical rule helpers to create dividers. A divider can be used to visually structure an interface by clearly separating content sections. |
| 5 | +group: helpers |
| 6 | +aliases: |
| 7 | + - "/docs/helpers/dividers/" |
| 8 | + - "/docs/helpers/vertical-rule/" |
| 9 | +toc: true |
| 10 | +--- |
| 11 | + |
| 12 | +## Horizontal rules |
| 13 | + |
| 14 | +Horizontal rules should use the `<hr>` tag, when the separator has semantic meaning (i.e., when it represents a topic change or a significant transition in the content). If the divider is purely decorative, prefer using a border CSS property on a `<div>` or our [border utilities]({{< docsref "/utilities/borders" >}}), or even ensure to hide it from assistive technologies (e.g., `aria-hidden="true"`). |
| 15 | + |
| 16 | +{{< example >}} |
| 17 | +<hr> |
| 18 | +<hr class="border-brand-primary"> |
| 19 | +<div class="border-top border-default my-medium"></div> |
| 20 | +<div class="border-top border-emphasized border-thick my-medium"></div> |
| 21 | +{{< /example >}} |
| 22 | + |
| 23 | +The `<hr>` color is automatically adjusted according to the color modes or on colored backgrounds. |
| 24 | + |
| 25 | +{{< example class="p-none">}} |
| 26 | +<div class="bg-brand-primary p-tall"> |
| 27 | + <div data-bs-theme="light"> |
| 28 | + <hr class="border-thick"> |
| 29 | + </div> |
| 30 | +</div> |
| 31 | +<div class="bg-status-negative-emphasized p-tall"> |
| 32 | + <div data-bs-theme="root-inverted"> |
| 33 | + <hr class="border-thicker"> |
| 34 | + </div> |
| 35 | +</div> |
| 36 | +{{< /example >}} |
| 37 | + |
| 38 | + |
| 39 | +{{< bootstrap-compatibility >}} |
| 40 | +The `<hr>` color can be set using [colors utilities]({{< docsref "/utilities/colors" >}}) |
| 41 | +{{< example >}} |
| 42 | +<hr class="text-brand-primary"> |
| 43 | +{{< /example >}} |
| 44 | +{{< /bootstrap-compatibility >}} |
| 45 | + |
| 46 | +## Vertical rules |
| 47 | + |
| 48 | +Vertical rules are inspired by the `<hr>` element, allowing you to create vertical dividers in common layouts. They're styled just like `<hr>` elements. They have `min-height` of `1em`. |
| 49 | + |
| 50 | +{{< example >}} |
| 51 | +<div class="vr"></div> |
| 52 | + |
| 53 | +{{< /example >}} |
| 54 | + |
| 55 | +Vertical rules scale their height in flex layouts: |
| 56 | + |
| 57 | +{{< example >}} |
| 58 | +<div class="d-flex" style="height: 200px;"> |
| 59 | + <div class="vr"></div> |
| 60 | + <div class="vr border-brand-primary"></div> |
| 61 | + <div class="vr border-thicker"></div> |
| 62 | +</div> |
| 63 | +{{< /example >}} |
| 64 | + |
| 65 | +The `.vr` color is automatically adjusted according to the color modes or on colored backgrounds. |
| 66 | + |
| 67 | +{{< example class="p-none">}} |
| 68 | +<div class="bg-brand-primary p-tall"> |
| 69 | + <div data-bs-theme="light"> |
| 70 | + <div class="vr border-thick"></div> |
| 71 | + </div> |
| 72 | +</div> |
| 73 | +<div class="bg-status-negative-emphasized p-tall"> |
| 74 | + <div data-bs-theme="root-inverted"> |
| 75 | + <div class="vr border-thicker"></div> |
| 76 | + </div> |
| 77 | +</div> |
| 78 | +{{< /example >}} |
| 79 | + |
| 80 | +{{< bootstrap-compatibility >}} |
| 81 | +The `.vr` color can be set using [colors utilities]({{< docsref "/utilities/colors" >}}) |
| 82 | +{{< example >}} |
| 83 | + <div class="vr text-brand-primary"></div> |
| 84 | +{{< /example >}} |
| 85 | +{{< /bootstrap-compatibility >}} |
| 86 | + |
0 commit comments