Skip to main content

Utilities

Borders

Add or remove borders, colour them with any theme colour, set width and opacity, and round corners with the theme's 2/6/12px scale.

Border

.border adds a 1px solid border in --bs-border-color — cream-300 in light mode, navy-500 in dark. Side classes add one edge. The boxes below are .p-3.mb-2 so you can see each edge against the dots.

Additive

.border
.border-top
.border-end
.border-bottom
.border-start
HTML
<div class="border p-3 mb-2">.border</div>
<div class="border-top p-3 mb-2">.border-top</div>
<div class="border-end p-3 mb-2">.border-end</div>
<div class="border-bottom p-3 mb-2">.border-bottom</div>
<div class="border-start p-3">.border-start</div>

Subtractive

Start from .border and remove edges.

.border.border-0
.border.border-top-0
.border.border-end-0
.border.border-bottom-0
.border.border-start-0
HTML
<div class="border border-0 p-3 mb-2">.border.border-0</div>
<div class="border border-top-0 p-3 mb-2">.border.border-top-0</div>
<div class="border border-end-0 p-3 mb-2">.border.border-end-0</div>
<div class="border border-bottom-0 p-3 mb-2">.border.border-bottom-0</div>
<div class="border border-start-0 p-3">.border.border-start-0</div>

Color

.border-* sets only the colour, so combine it with .border or a side class. All eleven theme colours plus black and white are generated.

.border-primary — gold-700 / gold-500
.border-secondary — navy-300
.border-success — green-600
.border-info — navy-500
.border-warning — gold-300
.border-danger — red-600
.border-light — cream-50
.border-dark — navy-900
.border-gold — gold-500
.border-navy — navy-700
.border-cream — cream-100
.border-black
.border-white
HTML
<div class="border border-primary p-3 mb-2">.border-primary — gold-700 / gold-500</div>
<div class="border border-secondary p-3 mb-2">.border-secondary — navy-300</div>
<div class="border border-success p-3 mb-2">.border-success — green-600</div>
<div class="border border-info p-3 mb-2">.border-info — navy-500</div>
<div class="border border-warning p-3 mb-2">.border-warning — gold-300</div>
<div class="border border-danger p-3 mb-2">.border-danger — red-600</div>
<div class="border border-light p-3 mb-2">.border-light — cream-50</div>
<div class="border border-dark p-3 mb-2">.border-dark — navy-900</div>
<div class="border border-gold p-3 mb-2">.border-gold — gold-500</div>
<div class="border border-navy p-3 mb-2">.border-navy — navy-700</div>
<div class="border border-cream p-3 mb-2">.border-cream — cream-100</div>
<div class="border border-black p-3 mb-2">.border-black</div>
<div class="border border-white p-3">.border-white</div>

Like text colours, these are fixed: .border-dark and .border-navy disappear on the dark-mode page, .border-light and .border-cream on the light one. Plain .border and the subtle variants follow the mode.

Subtle borders are the muted companions of .bg-*-subtle; they swap for darker values in dark mode.

.border-primary-subtle
.border-secondary-subtle
.border-success-subtle
.border-info-subtle
.border-warning-subtle
.border-danger-subtle
.border-light-subtle
.border-dark-subtle
HTML
<div class="border border-primary-subtle p-3 mb-2">.border-primary-subtle</div>
<div class="border border-secondary-subtle p-3 mb-2">.border-secondary-subtle</div>
<div class="border border-success-subtle p-3 mb-2">.border-success-subtle</div>
<div class="border border-info-subtle p-3 mb-2">.border-info-subtle</div>
<div class="border border-warning-subtle p-3 mb-2">.border-warning-subtle</div>
<div class="border border-danger-subtle p-3 mb-2">.border-danger-subtle</div>
<div class="border border-light-subtle p-3 mb-2">.border-light-subtle</div>
<div class="border border-dark-subtle p-3">.border-dark-subtle</div>
As with backgrounds, there is no .border-gold-subtle, .border-navy-subtle or .border-cream-subtle class. The variables --bs-gold-border-subtle, --bs-navy-border-subtle and --bs-cream-border-subtle are defined; apply them with an inline style or your own rule.

Border colour works on text too, where it is handy for a cheap underline: a .border-bottom.border-primary is the hard rule motif at 1px.

Underlined with a gold border
HTML
<span class="border-bottom border-primary border-2 pb-1">Underlined with a gold border</span>

Opacity

Colour utilities set --bs-border-opacity: 1 and paint with rgba(var(--bs-*-rgb), var(--bs-border-opacity)). Change the variable with .border-opacity-* or inline.

This is default navy border
This is 75% opacity navy border
This is 50% opacity navy border
This is 25% opacity navy border
This is 10% opacity navy border
HTML
<div class="border border-navy p-3 mb-2">This is default navy border</div>
<div class="border border-navy p-3 mb-2 border-opacity-75">This is 75% opacity navy border</div>
<div class="border border-navy p-3 mb-2 border-opacity-50">This is 50% opacity navy border</div>
<div class="border border-navy p-3 mb-2 border-opacity-25">This is 25% opacity navy border</div>
<div class="border border-navy p-3 border-opacity-10">This is 10% opacity navy border</div>
<div class="border border-gold p-3" style="--bs-border-opacity: .6">Gold border at 60%</div>

Width

.border-1 to .border-5 set the width in pixels. The default is 1px.

.border-1 — 1px
.border-2 — 2px
.border-3 — 3px
.border-4 — 4px
.border-5 — 5px
HTML
<div class="border border-1 p-3 mb-2">.border-1 — 1px</div>
<div class="border border-2 p-3 mb-2">.border-2 — 2px</div>
<div class="border border-3 p-3 mb-2">.border-3 — 3px</div>
<div class="border border-4 p-3 mb-2">.border-4 — 4px</div>
<div class="border border-5 p-3">.border-5 — 5px</div>

Radius

The theme has three real radii — 2px, 6px and 12px — so the five numbered classes overlap. Bootstrap's xl and xxl sizes alias the large value; the brand does not do big soft corners.

ClassVariableValueUsed by
.rounded-0—0Tables, .frame-bracket content
.rounded-1--bs-border-radius-sm2pxButtons, inputs, badges, alerts, tabs, pills, pagination, toasts, tooltips, dropdowns
.rounded, .rounded-2--bs-border-radius6pxCards, modals, popovers, list groups
.rounded-3--bs-border-radius-lg12pxLarge surfaces
.rounded-4--bs-border-radius-xl12px (alias)—
.rounded-5--bs-border-radius-xxl12px (alias)—
.rounded-circle—50%Avatars
.rounded-pill--bs-border-radius-pill999pxPill badges, pill buttons
0
2px
6px
12px
12px
50%
pill
HTML
<div class="rounded-0 text-bg-navy d-flex align-items-center justify-content-center" style="width: 5rem; height: 5rem">0</div>
<div class="rounded-1 text-bg-navy d-flex align-items-center justify-content-center" style="width: 5rem; height: 5rem">2px</div>
<div class="rounded text-bg-navy d-flex align-items-center justify-content-center" style="width: 5rem; height: 5rem">6px</div>
<div class="rounded-3 text-bg-navy d-flex align-items-center justify-content-center" style="width: 5rem; height: 5rem">12px</div>
<div class="rounded-5 text-bg-navy d-flex align-items-center justify-content-center" style="width: 5rem; height: 5rem">12px</div>
<div class="rounded-circle text-bg-gold d-flex align-items-center justify-content-center" style="width: 5rem; height: 5rem">50%</div>
<div class="rounded-pill text-bg-gold d-flex align-items-center justify-content-center" style="width: 8rem; height: 5rem">pill</div>

Sides

.rounded-{top|end|bottom|start} round two corners. Each takes the same size suffix, including -circle and -pill.

top
end
bottom
start
top-3
end-pill
bot-circle
mix
HTML
<div class="rounded-top text-bg-navy d-flex align-items-center justify-content-center" style="width: 5rem; height: 5rem">top</div>
<div class="rounded-end text-bg-navy d-flex align-items-center justify-content-center" style="width: 5rem; height: 5rem">end</div>
<div class="rounded-bottom text-bg-navy d-flex align-items-center justify-content-center" style="width: 5rem; height: 5rem">bottom</div>
<div class="rounded-start text-bg-navy d-flex align-items-center justify-content-center" style="width: 5rem; height: 5rem">start</div>
<div class="rounded-top-3 text-bg-gold d-flex align-items-center justify-content-center" style="width: 5rem; height: 5rem">top-3</div>
<div class="rounded-end-pill text-bg-gold d-flex align-items-center justify-content-center" style="width: 6rem; height: 5rem">end-pill</div>
<div class="rounded-bottom-circle text-bg-gold d-flex align-items-center justify-content-center" style="width: 5rem; height: 5rem">bot-circle</div>
<div class="rounded-start-0 rounded-3 text-bg-gold d-flex align-items-center justify-content-center" style="width: 5rem; height: 5rem">mix</div>

Generated side classes: .rounded-{top|end|bottom|start}, -0 … -5, -circle, -pill.

CSS

:root {
  --bs-border-width: 1px;
  --bs-border-style: solid;
  --bs-border-color: #d9cdb0;                              /* dark: #1e3a6e */
  --bs-border-color-translucent: rgba(10, 27, 61, 0.175);  /* dark: rgba(244, 236, 216, 0.15) */
  --bs-border-radius: 6px;
  --bs-border-radius-sm: 2px;
  --bs-border-radius-lg: 12px;
  --bs-border-radius-xl: 12px;
  --bs-border-radius-xxl: 12px;
  --bs-border-radius-pill: 999px;
}
.border { border: var(--bs-border-width) var(--bs-border-style) var(--bs-border-color) !important; }
.border-gold {
  --bs-border-opacity: 1;
  border-color: rgba(var(--bs-gold-rgb), var(--bs-border-opacity)) !important;
}

Sass

// scss/_variables.scss
$border-color: $rb-cream-300;
$border-color-translucent: rgba($rb-navy-900, 0.175);
$border-radius: 6px;
$border-radius-sm: 2px;
$border-radius-lg: 12px;
$border-radius-xl: 12px;
$border-radius-xxl: 12px;
$border-radius-pill: 999px;

Widths come from Bootstrap's $border-widths map (1–5), colours from $utilities-border-colors, and the radius sizes from the "border-radius" entry in $utilities. See the utility API.