Utilities
Text
Common text utilities to control alignment, wrapping, weight, size, line height, letter-spacing and more.
How it works
Most of the text utilities are stock Bootstrap. What this theme changes is the values behind them —
the type scale, the weights that the display font actually ships, and the three line heights — plus a small
set of additions: .font-display, .fw-black and the .ls-*
letter-spacing classes. Colors are on Colors; the heading and display classes
are on Typography.
Text alignment
Easily realign text to components with text alignment classes. For start, end, and center alignment, responsive classes are available that use the same viewport width breakpoints as the grid system.
Start aligned text on all viewport sizes.
Center aligned text on all viewport sizes.
End aligned text on all viewport sizes.
End aligned text on viewports sized SM (small) or wider.
End aligned text on viewports sized MD (medium) or wider.
End aligned text on viewports sized LG (large) or wider.
End aligned text on viewports sized XL (extra large) or wider.
End aligned text on viewports sized XXL (extra extra large) or wider.
HTML
<p class="text-start">Start aligned text on all viewport sizes.</p>
<p class="text-center">Center aligned text on all viewport sizes.</p>
<p class="text-end">End aligned text on all viewport sizes.</p>
<p class="text-sm-end">End aligned text on viewports sized SM (small) or wider.</p>
<p class="text-md-end">End aligned text on viewports sized MD (medium) or wider.</p>
<p class="text-lg-end">End aligned text on viewports sized LG (large) or wider.</p>
<p class="text-xl-end">End aligned text on viewports sized XL (extra large) or wider.</p>
<p class="text-xxl-end">End aligned text on viewports sized XXL (extra extra large) or wider.</p>Text wrapping and overflow
Wrap text with a .text-wrap class.
HTML
<div class="badge text-bg-primary text-wrap" style="width: 6rem;">
This text should wrap.
</div>Prevent text from wrapping with a .text-nowrap class.
HTML
<div class="text-nowrap bg-body-tertiary border" style="width: 8rem;">
This text should overflow the parent.
</div>
For longer content, you can add a .text-truncate class to truncate the text with an ellipsis.
Requires display: inline-block or display: block. See also the
text truncation helper.
HTML
<!-- Block level -->
<div class="row">
<div class="col-2 text-truncate">
This text is quite long, and will be truncated once displayed.
</div>
</div>
<!-- Inline level -->
<span class="d-inline-block text-truncate" style="max-width: 150px;">
This text is quite long, and will be truncated once displayed.
</span>Word break
Prevent long strings of text from breaking your components' layout by using .text-break to set
word-wrap: break-word and word-break: break-word. We use word-wrap
instead of the more common overflow-wrap for wider browser support, and add the deprecated
word-break: break-word to avoid issues with flex containers.
mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm
HTML
<p class="text-break">mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm</p>Text transform
Transform text in components with text capitalization classes.
Lowercased text.
Uppercased text.
CapiTaliZed text.
HTML
<p class="text-lowercase">Lowercased text.</p>
<p class="text-uppercase">Uppercased text.</p>
<p class="text-capitalize">CapiTaliZed text.</p>
Note how .text-capitalize only changes the first letter of each word, leaving the case of any
other letters unaffected.
Display headings and .text-marquee are already uppercase in this theme; you do not need to
add .text-uppercase to them. See Motifs.
Font size
Quickly change the font-size of text. While our heading classes (e.g. .h1–.h6)
apply font-size, font-weight, and line-height, these utilities
only apply font-size. Sizing for these utilities matches the theme's heading scale,
which is not stock Bootstrap's: .fs-1 is 3 rem here (2.5 rem in stock) and
.fs-6 is .875 rem (1 rem in stock). .fs-1 to .fs-3 are fluid below
1200 px.
.fs-1 text
.fs-2 text
.fs-3 text
.fs-4 text
.fs-5 text
.fs-6 text
HTML
<p class="fs-1">.fs-1 text</p>
<p class="fs-2">.fs-2 text</p>
<p class="fs-3">.fs-3 text</p>
<p class="fs-4">.fs-4 text</p>
<p class="fs-5">.fs-5 text</p>
<p class="fs-6">.fs-6 text</p>| Class | ≥ 1200 px | Below 1200 px | Token | Stock 5.3 |
|---|---|---|---|---|
.fs-1 | 3 rem | calc(1.425rem + 2.1vw) | --font-size-3xl | 2.5 rem |
.fs-2 | 2 rem | calc(1.325rem + .9vw) | --font-size-2xl | 2 rem |
.fs-3 | 1.5 rem | calc(1.275rem + .3vw) | --font-size-xl | 1.75 rem |
.fs-4 | 1.125 rem | 1.125 rem | --font-size-lg | 1.5 rem |
.fs-5 | 1 rem | 1 rem | --font-size-md | 1.25 rem |
.fs-6 | .875 rem | .875 rem | --font-size-sm | 1 rem |
Customize your available font-sizes by modifying the $font-sizes Sass map. There
are no responsive .fs-* variants.
Font weight and italics
Quickly change the font-weight or font-style of text with these utilities.
font-style utilities are abbreviated as .fst-* and font-weight
utilities are abbreviated as .fw-*.
Black weight text (800).
Bold text (700).
Bolder weight text (800 in this theme).
Semibold weight text (600).
Medium weight text (500).
Normal weight text (400).
Light weight text (300).
Lighter weight text (relative to the parent element).
Italic text.
Text with normal font style
HTML
<p class="fw-black">Black weight text (800).</p>
<p class="fw-bold">Bold text (700).</p>
<p class="fw-bolder">Bolder weight text (800 in this theme).</p>
<p class="fw-semibold">Semibold weight text (600).</p>
<p class="fw-medium">Medium weight text (500).</p>
<p class="fw-normal">Normal weight text (400).</p>
<p class="fw-light">Light weight text (300).</p>
<p class="fw-lighter">Lighter weight text (relative to the parent element).</p>
<p class="fst-italic">Italic text.</p>
<p class="fst-normal">Text with normal font style</p>| Class | font-weight | Note |
|---|---|---|
.fw-black | 800 | Theme addition. The marquee weight — what display headings use. |
.fw-bolder | 800 | Stock uses the bolder keyword; this theme pins it to 800. |
.fw-bold | 700 | |
.fw-semibold | 600 | |
.fw-medium | 500 | Button weight. |
.fw-normal | 400 | |
.fw-light | 300 | |
.fw-lighter | lighter | Relative to the parent. |
.font-display
element, .fw-normal and .fw-light fall back to a synthesised or system weight.
Keep the display face bold or black.Line height
Change the line height with .lh-* utilities. The three named steps map onto the theme's
--line-height-tight, -normal and -loose tokens.
This is a long paragraph written to show how the line-height of an element is affected by our utilities. Classes are applied to the element itself or sometimes the parent element. These classes can be customized as needed with our utility API.
This is a long paragraph written to show how the line-height of an element is affected by our utilities. Classes are applied to the element itself or sometimes the parent element. These classes can be customized as needed with our utility API.
This is a long paragraph written to show how the line-height of an element is affected by our utilities. Classes are applied to the element itself or sometimes the parent element. These classes can be customized as needed with our utility API.
This is a long paragraph written to show how the line-height of an element is affected by our utilities. Classes are applied to the element itself or sometimes the parent element. These classes can be customized as needed with our utility API.
HTML
<p class="lh-1">This is a long paragraph written to show how the line-height of an element is affected by our utilities. Classes are applied to the element itself or sometimes the parent element. These classes can be customized as needed with our utility API.</p>
<p class="lh-sm">This is a long paragraph written to show how the line-height of an element is affected by our utilities. Classes are applied to the element itself or sometimes the parent element. These classes can be customized as needed with our utility API.</p>
<p class="lh-base">This is a long paragraph written to show how the line-height of an element is affected by our utilities. Classes are applied to the element itself or sometimes the parent element. These classes can be customized as needed with our utility API.</p>
<p class="lh-lg">This is a long paragraph written to show how the line-height of an element is affected by our utilities. Classes are applied to the element itself or sometimes the parent element. These classes can be customized as needed with our utility API.</p>| Class | line-height | Token | Stock 5.3 |
|---|---|---|---|
.lh-1 | 1 | display headings | 1 |
.lh-sm | 1.15 | --line-height-tight (h1–h6) | 1.25 |
.lh-base | 1.5 | --line-height-normal | 1.5 |
.lh-lg | 1.75 | --line-height-loose | 2 |
Font family
Two family utilities. .font-monospace is stock; .font-display is the theme's
addition and switches to Big Shoulders Display, the face that h1–h3 and the display classes use. It sets
only the family — add .fw-black, .text-uppercase and
.ls-display yourself, or use .text-marquee which bundles all four (see
Motifs).
This is in monospace — 1985 · 1-2-3 · 22:31
This is in the display face — Main Event
HTML
<p class="font-monospace">This is in monospace — 1985 · 1-2-3 · 22:31</p>
<p class="font-display fs-2 fw-black text-uppercase ls-display mb-0">This is in the display face — Main Event</p>.font-display only with .fs-3 or larger.Letter spacing
Theme addition. Three tracking values that correspond to the brand's three uses of caps: the display face, eyebrow labels, and "turn it off".
.ls-tight — 0, body caps and abbreviations
.ls-display — 0.01em, the display face
.ls-wide — 0.08em, eyebrows and labels
HTML
<p class="ls-tight text-uppercase">.ls-tight — 0, body caps and abbreviations</p>
<p class="ls-display text-uppercase font-display fs-3 fw-bold">.ls-display — 0.01em, the display face</p>
<p class="ls-wide text-uppercase fs-6 font-monospace text-body-secondary mb-0">.ls-wide — 0.08em, eyebrows and labels</p>| Class | letter-spacing | Use |
|---|---|---|
.ls-tight | 0 | Reset. Caps in running text. |
.ls-display | 0.01em | Big Shoulders at any size. Already applied to h1–h3 and display classes. |
.ls-wide | 0.08em | Small uppercase labels — eyebrows, table headers, badges. |
Text decoration
Decorate text in components with text decoration classes. Links are underlined by default in this theme,
so .text-decoration-none is the one you will reach for most.
This text has a line underneath it.
This text has a line going through it.
This link has its text decoration removedHTML
<p class="text-decoration-underline">This text has a line underneath it.</p>
<p class="text-decoration-line-through">This text has a line going through it.</p>
<a href="#text-decoration" class="text-decoration-none">This link has its text decoration removed</a>For underline offset, color and opacity on links, see the link utilities.
Reset color
Reset a text or link's color with .text-reset, so that it inherits the color from its parent.
Muted text with a reset link.
HTML
<p class="text-body-secondary">
Muted text with a <a href="#reset-color" class="text-reset">reset link</a>.
</p>
.text-muted still compiles for compatibility, but it is deprecated upstream; use
.text-body-secondary.
CSS
Sass variables
Default type-related Sass variables as set in scss/_variables.scss:
$font-family-sans-serif: $rb-font-sans;
$font-family-monospace: $rb-font-mono;
$display-font-family: $rb-font-display; // Big Shoulders Display
$font-size-base: 1rem;
$font-size-sm: 0.875rem;
$font-size-lg: 1.125rem;
$font-weight-medium: 500;
$font-weight-bold: 700;
$font-weight-bolder: 800;
$line-height-base: 1.5;
$line-height-sm: 1.15;
$line-height-lg: 1.75;
$h1-font-size: 3rem; // .fs-1
$h2-font-size: 2rem; // .fs-2
$h3-font-size: 1.5rem; // .fs-3
$h4-font-size: 1.125rem; // .fs-4
$h5-font-size: 1rem; // .fs-5
$h6-font-size: 0.875rem; // .fs-6
Utilities API
The theme's additions, from scss/_utilities.scss, merged into Bootstrap's map:
"font-family": (
property: font-family,
class: font,
values: (
monospace: var(--bs-font-monospace),
display: var(--bs-font-display), // added
)
),
"font-weight": (
property: font-weight,
class: fw,
values: (
lighter: lighter, light: 300, normal: 400, medium: 500,
semibold: 600, bold: 700, bolder: 800,
black: 800, // added
)
),
"letter-spacing": ( // added
property: letter-spacing,
class: ls,
values: (tight: 0, display: 0.01em, wide: 0.08em),
),