Typography
Documentation and examples for common text utilities to control alignment, wrapping, weight, and more.
Spacing on BootstrapText 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.
<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-start">Start aligned text on viewports sized SM (small) or wider.</p>
<p class="text-md-start">Start aligned text on viewports sized MD (medium) or wider.</p>
<p class="text-lg-start">Start aligned text on viewports sized LG (large) or wider.</p>
<p class="text-xl-start">Start aligned text on viewports sized XL (extra-large) or wider.</p>
Start aligned text on all viewport sizes.
Center aligned text on all viewport sizes.
End aligned text on all viewport sizes.
Start aligned text on viewports sized SM (small) or wider.
Start aligned text on viewports sized MD (medium) or wider.
Start aligned text on viewports sized LG (large) or wider.
Start aligned text on viewports sized XL (extra-large) or wider.
Text wrapping and overflow
Wrap text with a .text-wrap
class. Prevent text from wrapping with a .text-nowrap
class.
<div class="badge bg-primary text-wrap mb-3" style="width: 6rem;">This text should wrap.</div>
<div class="text-nowrap bg-300" style="width: 8rem;">This text should overflow the parent.</div>
Word break
Prevent long strings of text from breaking your component's 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.
<p class="text-break">mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm</p>
mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm
Text transform
Transform text in components with text capitalization classes.
<p class="text-lowercase">Lowercased text.</p>
<p class="text-uppercase">Uppercased text.</p>
<p class="text-capitalize">CapiTaliZed text.</p>
Lowercased text.
Uppercased text.
CapiTaliZed text.
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 HTML’s heading elements, so as the number increases, their size decreases.
<h6 class="fs--2">.fs--2</h6>
<h6 class="fs--1">.fs--1</h6>
<h6 class="fs-0">.fs-0</h6>
<h6 class="fs-1">.fs-1</h6>
<h6 class="fs-2">.fs-2</h6>
<h6 class="fs-3">.fs-3</h6>
<h6 class="fs-4">.fs-4</h6>
<h6 class="fs-5">.fs-5</h6>
<h6 class="fs-6">.fs-6</h6>
<h6 class="fs-7">.fs-7</h6>
<h6 class="fs-8">.fs-8</h6>
<div class="mt-3">
<h6 class="fs-sm-0">.fs-sm-0</h6>
<h6 class="fs-md-1">.fs-md-1</h6>
<h6 class="fs-lg-2">.fs-lg-2</h6>
<h6 class="fs-xl-3">.fs-xl-3</h6>
</div>
.fs--2
.fs--1
.fs-0
.fs-1
.fs-2
.fs-3
.fs-4
.fs-5
.fs-6
.fs-7
.fs-8
.fs-sm-0
.fs-md-1
.fs-lg-2
.fs-xl-3
Font weight
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-*
.
<div class="fw-light">Font weight 300</div>
<div class="fw-normal">Font weight 400</div>
<div class="fw-medium">Font weight 500</div>
<div class="fw-semi-bold">Font weight 600</div>
<div class="fw-bold">Font weight 700</div>
<div class="fw-bolder">Font weight 800</div>
<div class="fw-black">Font weight 900</div>
Line height
Change the line height with .lh-*
utilities.
<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>
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.
Heading
<h1>h1. Heading</h1>
<h2>h2. Heading</h2>
<h3>h3. Heading</h3>
<h4>h4. Heading</h4>
<h5>h5. Heading</h5>
<h6>h6. Heading</h6>
h1. Heading
h2. Heading
h3. Heading
h4. Heading
h5. Heading
h6. Heading
Heading classes
<p class="h1">h1. Heading</p>
<p class="h2">h2. Heading</p>
<p class="h3">h3. Heading</p>
<p class="h4">h4. Heading</p>
<p class="h5">h5. Heading</p>
<p class="h6">h6. Heading</p>
h1. Heading
h2. Heading
h3. Heading
h4. Heading
h5. Heading
h6. Heading
Display
<h1 class="display-1 mb-3">Display 1</h1>
<h1 class="display-2 mb-3">Display 2</h1>
<h1 class="display-3 mb-3">Display 3</h1>
<h1 class="display-4 mb-3">Display 4</h1>
<h1 class="display-5 mb-3">Display 5</h1>
<h1 class="display-6 mb-3">Display 6</h1>
Display 1
Display 2
Display 3
Display 4
Display 5
Display 6
Font family
You have three font-family helper classes available to use.
<div class="font-sans-serif">Nunito sans</div>
<div class="font-base">Open Sans</div>
<code class="text-monospace">Monospace</code>
Monospace
Reset color
Reset a text or link's color with .text-reset
, so that it inherits the color from its parent.
<p class="text-muted">Muted text with a <a class="text-reset" href="#">reset link</a>.</p>
Muted text with a reset link.
Text decoration
Decorate text in components with text decoration classes.
<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 class="text-decoration-none" href="#">This link has its text decoration removed</a>
This text has a line underneath it.
This text has a line going through it.
This link has its text decoration removed