Text

Text alignment, transform, decoration, and truncation utilities.

Text Alignment

Align text within its container using text-{side} classes. All alignment utilities include full responsive variants.

text-left - The quick brown fox jumps over the lazy dog.

text-center - The quick brown fox jumps over the lazy dog.

text-right - The quick brown fox jumps over the lazy dog.

text-justify - The quick brown fox jumps over the lazy dog. Sphinx of black quartz, judge my vow. How vexingly quick daft zebras jump.

<p class="text-left">Left aligned</p>
<p class="text-center">Centered</p>
<p class="text-right">Right aligned</p>
<p class="text-justify">Justified</p>
ClassPropertiesDescription
text-lefttext-align: leftAlign to the left
text-center / centertext-align: centerCenter alignment
text-righttext-align: rightAlign to the right
text-justifytext-align: justifyJustify to both edges
text-starttext-align: startLogical start (RTL-aware)
text-endtext-align: endLogical end (RTL-aware)
Responsive variants. Prefix any alignment class with a breakpoint to apply it conditionally - e.g. text-left md:text-center is left-aligned on mobile and centered from tablet up.

Text Transform

Change the visual case of text without altering the underlying HTML.

uppercase - The quick brown fox

LOWERCASE - THE QUICK BROWN FOX

capitalize - the quick brown fox

no-case - RESETS any transform (text-transform: none)

<p class="uppercase">The quick brown fox</p>
<p class="lowercase">THE QUICK BROWN FOX</p>
<p class="capitalize">the quick brown fox</p>
<p class="no-case">reset transform</p>
ClassPropertiesDescription
uppercasetext-transform: uppercaseAll uppercase characters
lowercasetext-transform: lowercaseAll lowercase characters
capitalizetext-transform: capitalizeFirst letter of each word capitalized
no-casetext-transform: noneRemove any text transform
upperfirst::first-letter { text-transform: uppercase }Only the first letter of the block

Text Decoration

Add or remove decorative lines from text. Decoration classes can be combined with color and style modifiers.

underline - The quick brown fox

overline - The quick brown fox

strike - The quick brown fox

deleted - The quick brown fox

d-none - removes decoration (applied after underline here)

<p class="underline">Underlined text</p>
<p class="overline">Overlined text</p>
<p class="strike">Strikethrough text</p>
<p class="d-none">No decoration</p>

<!-- Combine with color -->
<p class="underline underline-primary">Primary colored underline</p>

<!-- Combine with style -->
<p class="underline underline-wavy">Wavy underline</p>
<p class="underline underline-dashed">Dashed underline</p>
ClassPropertiesDescription
underlinetext-decoration: underlineUnderline
overlinetext-decoration: overlineLine above text
striketext-decoration: line-throughStrikethrough
deletedtext-decoration: line-throughDeleted / struck text
d-nonetext-decoration: noneRemove decoration

Decoration color & style modifiers

Combine decoration classes with color and style suffixes. Any theme color can be used as a suffix (e.g. underline-primary, strike-danger). Style suffixes: solid, double, dotted, dashed, wavy.

<!-- Color modifiers -->
<span class="underline underline-primary">Primary</span>
<span class="underline underline-success">Success</span>
<span class="underline underline-danger">Danger</span>

<!-- Style modifiers -->
<span class="underline underline-wavy">Wavy</span>
<span class="underline underline-dotted">Dotted</span>

Line Clamp

Truncate multi-line text to a fixed number of lines with an ellipsis. Uses -webkit-line-clamp under the hood, widely supported in all modern browsers.

line-clamp-2

The quick brown fox jumps over the lazy dog. Sphinx of black quartz, judge my vow. How vexingly quick daft zebras jump. The five boxing wizards jump quickly. Pack my box with five dozen liquor jugs. Jackdaws love my big sphinx of quartz.

line-clamp-3

The quick brown fox jumps over the lazy dog. Sphinx of black quartz, judge my vow. How vexingly quick daft zebras jump. The five boxing wizards jump quickly. Pack my box with five dozen liquor jugs. Jackdaws love my big sphinx of quartz.

<p class="line-clamp-1">Truncate to one line...</p>
<p class="line-clamp-2">Truncate to two lines...</p>
<p class="line-clamp-3">Truncate to three lines...</p>
<p class="line-clamp-4">Truncate to four lines...</p>
<p class="line-clamp-5">Truncate to five lines...</p>
<p class="line-clamp-6">Truncate to six lines...</p>
ClassLines shownDescription
line-clamp-11Single-line truncation
line-clamp-22Two-line truncation
line-clamp-33Three-line truncation
line-clamp-44Four-line truncation
line-clamp-55Five-line truncation
line-clamp-66Six-line truncation

Text ellipsis

Truncate a single line with an ellipsis. Apply .text-ellipsis together with an overflow constraint so the overflowed text is actually clipped.

This long label gets truncated with an ellipsis at the end of the line.
<!-- Truncate long single-line labels -->
<span class="text text-ellipsis" style="white-space:nowrap; overflow:hidden; max-width:16rem; display:inline-block;">
  This long label gets truncated with an ellipsis
</span>

Text Shadow

Add a soft shadow to text. .text-shadow uses the default color; .text-shadow-{color} tints the shadow with any theme color.

text-shadow - Soft shadow

text-shadow-primary - Primary glow

text-shadow-grey - Grey tint

<!-- Default soft shadow -->
<p class="text-shadow">Soft shadow</p>

<!-- Colored shadow -->
<p class="text-primary text-shadow-primary">Primary glow</p>

<!-- Pseudo-state variant -->
<p class="hover:text-shadow">Shadow on hover</p>
ClassPropertiesDescription
.text-shadowtext-shadow: 2px 2px 5px currentColorSoft default shadow
.text-shadow-{color}text-shadow tinted with the theme colorTinted shadow

Both classes also ship hover:, focus:, and active: rivals, e.g. hover:text-shadow.

Vertical Alignment

Control the vertical alignment of inline or table-cell elements.

align-top
align-middle
align-bottom
align-baseline
<span class="align-top">Top</span>
<span class="align-middle">Middle</span>
<span class="align-bottom">Bottom</span>
<span class="align-baseline">Baseline</span>
<span class="align-auto">Auto</span>
ClassPropertiesDescription
align-autovertical-align: autoBrowser default
align-baselinevertical-align: baselineAlign to text baseline
align-topvertical-align: topAlign to top of line box
align-middlevertical-align: middleCenter vertically
align-bottomvertical-align: bottomAlign to bottom of line box

Responsive text

Text alignment and transform utilities both support responsive breakpoint prefixes using the mobile-first approach. Prefix any class with a breakpoint followed by :.

<!-- Left on mobile, centered from md up -->
<p class="text-left md:text-center">Responsive alignment</p>

<!-- Normal on mobile, uppercase from lg up -->
<p class="no-case lg:uppercase">Responsive transform</p>

<!-- Line clamp responsive -->
<p class="line-clamp-3 md:line-clamp-5">
  More lines visible on wider screens...
</p>
Available breakpoints: xs: (375px), sm: (544px), md: (768px), lg: (992px), xl: (1200px), xxl: (1440px). See responsive docs for full details.