Documentation and examples for common text utilities to control alignment, wrapping, weight, and more.

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.

We recommend to avoid using center and end alignment but in very specific cases. However, please note that you may use .ms-{breakpoint}-auto (respectively .mx-{breakpoint}-auto) in addition of .text-{breakpoint}-end (respectively .text-{breakpoint}-center) in these cases.

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 XS (x-small) or wider.

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 (x-large) or wider.

End aligned text on viewports sized 2XL (2x-large) or wider.

End aligned text on viewports sized 3XL (3x-large) or wider.

<p class="text-start">Start aligned text on all viewport sizes.</p>
<p class="text-center mx-auto">Center aligned text on all viewport sizes.</p>
<p class="text-end ms-auto">End aligned text on all viewport sizes.</p>

<p class="text-xs-end ms-xs-auto">End aligned text on viewports sized XS (x-small) or wider.</p>
<p class="text-sm-end ms-sm-auto">End aligned text on viewports sized SM (small) or wider.</p>
<p class="text-md-end ms-md-auto">End aligned text on viewports sized MD (medium) or wider.</p>
<p class="text-lg-end ms-lg-auto">End aligned text on viewports sized LG (large) or wider.</p>
<p class="text-xl-end ms-xl-auto">End aligned text on viewports sized XL (x-large) or wider.</p>
<p class="text-2xl-end ms-2xl-auto">End aligned text on viewports sized 2XL (2x-large) or wider.</p>
<p class="text-3xl-end ms-3xl-auto">End aligned text on viewports sized 3XL (3x-large) or wider.</p>
html

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.

This text should wrap.
<div class="badge text-bg-brand-primary text-wrap" style="width: 6rem;">
  This text should wrap.
</div>
html

Prevent text from wrapping with a .text-nowrap class.

This text should overflow the parent.
<div class="text-nowrap bg-secondary border" style="width: 8rem;">
  This text should overflow the parent.
</div>
html

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>
html

Note that breaking words isn’t possible in Arabic, which is the most used RTL language. Therefore .text-break is removed from our RTL compiled CSS.

Text transform

Transform text in components with our text capitalization classes: text-lowercase, text-uppercase or text-capitalize.

Lowercased text.

Uppercased text.

CapiTaliZed text.

<p class="text-lowercase">Lowercased text.</p>
<p class="text-uppercase">Uppercased text.</p>
<p class="text-capitalize">CapiTaliZed text.</p>
html

Note how .text-capitalize only changes the first letter of each word, leaving the case of any other letters unaffected.

Font size

Quickly change the font-size of text. Sizing for these utilities matches our predefined typography placeholders. Don’t forget to add one of our font-weight utility when needed.

These classes change the font-size but also the line-height, the letter-spacing and the max-width. If you want to get rid of the max-width, please make sure to use our .mw-none width utility.

.fs-dl text

.fs-dm text

.fs-ds text

.fs-hxl text

.fs-hl text

.fs-hm text

.fs-hs text

.fs-bl text

.fs-bm text

.fs-bs text

.fs-cm.font-monospace text

.fs-cs.font-monospace text

<p class="fs-dl">.fs-dl text</p>
<p class="fs-dm">.fs-dm text</p>
<p class="fs-ds">.fs-ds text</p>
<p class="fs-hxl">.fs-hxl text</p>
<p class="fs-hl">.fs-hl text</p>
<p class="fs-hm">.fs-hm text</p>
<p class="fs-hs">.fs-hs text</p>
<p class="fs-bl">.fs-bl text</p>
<p class="fs-bm">.fs-bm text</p>
<p class="fs-bs">.fs-bs text</p>
<p class="fs-cm font-monospace">.fs-cm.font-monospace text</p>
<p class="fs-cs font-monospace">.fs-cs.font-monospace text</p>
html

Customize your available font-sizes by modifying the $ouds-font-sizes Sass map.

You can easily add an icon with your font reference using our icon size utilities.

Bootstrap $enable-bootstrap-compatibility: true

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-1 text

.fs-2 text

.fs-3 text

.fs-4 text

.fs-5 text

.fs-6 text

<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>
html

Customize your available font-sizes by modifying the $font-sizes Sass map.

Font weight

Quickly change the font-weight of text with these utilities. font-weight utilities are abbreviated as .fw-*.

Bold text.

Normal weight text.

<p class="fw-bold">Bold text.</p>
<p class="fw-normal">Normal weight text.</p>
html
Bootstrap $enable-bootstrap-compatibility: true

Bold text.

Bolder weight text (relative to the parent element).

Semibold weight text.

Medium weight text.

Normal weight text.

Light weight text.

Lighter weight text (relative to the parent element).

<p class="fw-bold">Bold text.</p>
<p class="fw-bolder">Bolder weight text (relative to the parent element).</p>
<p class="fw-semibold">Semibold weight text.</p>
<p class="fw-medium">Medium weight text.</p>
<p class="fw-normal">Normal weight text.</p>
<p class="fw-light">Light weight text.</p>
<p class="fw-lighter">Lighter weight text (relative to the parent element).</p>
html

Line height

Change the line height with .lh-* utilities. You need to enable Bootstrap compatibility to use these utilities since most of our font embed a proper line-height.

Bootstrap $enable-bootstrap-compatibility: true

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>
html

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>
html

Reset color

Reset a text or link’s color with .text-reset, so that it inherits the color from its parent.

Secondary body text with a reset link.

<p class="text-muted">
  Secondary body text with a <a href="#" class="text-reset">reset link</a>.
</p>
html

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>
html