Text alignment
Easily realign text to components with text alignment classes.
Start aligned text
Center aligned text
End aligned text
<p class="text-start">Start aligned text</p>
<p class="text-center">Center aligned text</p>
<p class="text-end">End aligned text</p>
Note that we don't provide utility classes for justified text. While, aesthetically, justified text might look more appealing, it does make word-spacing more random and therefore harder to read.
Text wrapping and overflow
Wrap text with a .text-wrap
class.
<div class="wui-bg-color--primary wui-color--white text-wrap" style="width: 9rem;">
This text should wrap.
</div>
Prevent text from wrapping with a .text-nowrap
class.
<div class="text-nowrap wui-bg-color--gray-87 border-1" style="width: 13rem;">
This text should overflow the parent.
</div>
Text truncation
For the class .text-line-clamp-1
you can use values from 1 to 6, depending on the line where the text should be truncated. Additionally, the class .text-fade-out
can be used to fade out the text if necessary.
<div class="text-line-clamp-3 text-fade-out">
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Tortor aliquam nulla facilisi cras fermentum odio eu feugiat pretium. Habitant morbi tristique senectus et netus et. Vestibulum lorem sed risus ultricies tristique nulla aliquet. Maecenas accumsan lacus vel facilisis volutpat est. Lectus urna duis convallis convallis tellus id. Massa massa ultricies mi quis. Est placerat in egestas erat imperdiet sed euismod nisi. Leo a diam sollicitudin tempor id. Quis viverra nibh cras pulvinar mattis nunc. Placerat orci nulla pellentesque dignissim enim sit. Nullam eget felis eget nunc. At in tellus integer feugiat scelerisque. Suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Nec nam aliquam sem et. Pharetra massa massa ultricies mi quis hendrerit dolor. Morbi tristique senectus et netus. Pulvinar mattis nunc sed blandit libero volutpat sed. Lorem sed risus ultricies tristique nulla.
</div>
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.
mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm
<p class="text-break">mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm</p>
Text transform
Transform text in components with text capitalization classes.
Lowercased text.
Uppercased text.
CapiTaliZed text changes the first letter of each word.
<p class="text-lowercase">Lowercased text.</p>
<p class="text-uppercase">Uppercased text.</p>
<p class="text-capitalize">CapiTaliZed text changes the first letter of each word.</p>
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.
.fs-sm text
.fs-md text
.fs-lg text
<p class="fs-sm">.fs-sm text</p>
<p class="fs-md">.fs-md text</p>
<p class="fs-lg">.fs-lg text</p>
Customize your available font-size
s by modifying the $font-sizes
Sass map.
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-*
.
Bold text.
Normal weight text.
Italic text.
Text with normal font style
<p class="fw-bold">Bold text.</p>
<p class="fw-normal">Normal weight text.</p>
<p class="fst-italic">Italic text.</p>
<p class="fst-normal">Text with normal font style</p>
Line height
Change the line height with .lh-*
utilities.
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.
<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>
Monospace
Change a selection to our monospace font stack with .font-monospace
.
This is in monospace
<p class="font-monospace">This is in monospace</p>
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.
<p class="text-body-secondary">
Muted text with a <a href="#" class="text-reset">reset link</a>.
</p>
Text decoration
Decorate text in components with text decoration classes.
This text has a line underneath it.
This text has a line going through it.
This link has its text decoration removed<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="#" class="text-decoration-none">This link has its text decoration removed</a>