Text Formatting
Text Formatting utilities control how text is aligned, transformed, decorated, wrapped, truncated, and balanced. Use these utilities when the content itself is already sized correctly, but its presentation needs adjustment.
For text size, muted text, paragraph rhythm, and drop caps, see the Text documentation.
All text formatting utilities are pure CSS and do not require the FrontAlign runtime.
Quick reference
| Group | Classes | Effect | Common use |
|---|---|---|---|
| Alignment |
| text-align: start | end | center | justify | Hero sections, metadata, editorial content. |
| Transform |
| text-transform: uppercase | lowercase | capitalize | Labels, badges, titles, eyebrow text. |
| Decoration |
| text-decoration: underline | overline | line-through | none | Links, deleted prices, decorative typography. |
| Truncation | text-truncate | overflow: hidden; text-overflow: ellipsis; white-space: nowrap | Card titles, table cells, single-line overflow. |
| Wrapping |
| white-space | overflow-wrap | text-wrap | Headings, long URLs, prices, paragraph flow. |
Usage
<p className="text-center text-uppercase">
FrontAlign Framework
</p>
FrontAlign Framework
Text alignment
FrontAlign uses logical alignment values where possible.
<!-- Start-aligned based on writing direction -->
<p className="text-start">Left-to-right content.</p>
<!-- Centered heading or hero text -->
<section className="text-center">
<h1>Build modern interfaces faster.</h1>
<p>One lightweight engine for any stack.</p>
</section>
<!-- End-aligned metadata -->
<p className="text-end">Updated today</p>
<!-- Justified editorial content -->
<p className="text-justify">Long-form article body text.</p>
Left-to-right content.
Build modern interfaces faster.
One lightweight engine for any stack.
Updated today
Long-form article body text that demonstrates how justified text spreads evenly across the full width of its container on every line except the last.
Text transform
<!-- Uppercase label or badge -->
<span className="text-uppercase">New Release</span>
<!-- Capitalize a title -->
<h3 className="text-capitalize">premium dashboard template</h3>
premium dashboard template
Text decoration
<!-- Deleted price with strikethrough -->
<p>
<span className="text-line-through text-muted">$49</span>
<span>$29</span>
</p>
<!-- Remove link underline -->
<a href="#" className="text-no-decoration">Documentation</a>
$49$29
DocumentationTruncation
Use text-truncate for single-line overflow with an ellipsis. The container must have a constrained width.
.text-truncate {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
<p className="text-truncate">
This is a very long title that will be truncated with an ellipsis when it overflows.
</p>
This is a very long title that will be truncated with an ellipsis when it overflows.
For multi-line truncation, use the Line Clamp documentation.
No wrap
Use text-nowrap to prevent a phrase or value from breaking across lines.
<span className="text-nowrap">Do not break this phrase</span>
Text break
Use text-break for long URLs, tokens, file names, and user-generated content that could overflow its container.
<p className="text-break">
https://example.com/very/long/path/that/should/not/break/the/layout
</p>
https://example.com/very/long/path/that/should/not/break/the/layout
Pretty text
Use text-pretty for better paragraph wrapping in browsers that support it.
<p className="text-pretty">
FrontAlign helps improve the reading experience by supporting modern text wrapping utilities.
</p>
FrontAlign helps improve the reading experience by supporting modern text wrapping utilities.
Balanced text
Use text-balance for headings and short display text to distribute line length more evenly.
<h1 className="text-balance">
Build modern interfaces without framework chaos.
</h1>
Build modern interfaces without framework chaos.
Utility scales
The full class list for each group, with CSS output and recommended use.
Alignment
| Class | CSS | Recommended use |
|---|---|---|
text-start | text-align: start | Start-aligned content based on writing direction. |
text-end | text-align: end | End-aligned content based on writing direction. |
text-center | text-align: center | Centered headings, hero text, empty states. |
text-justify | text-align: justify | Editorial and long-form content. |
Transform
| Class | CSS | Recommended use |
|---|---|---|
text-uppercase | text-transform: uppercase | Labels, badges, eyebrow text. |
text-lowercase | text-transform: lowercase | Normalization and stylistic text. |
text-capitalize | text-transform: capitalize | Titles, names, categories. |
Decoration
| Class | CSS | Recommended use |
|---|---|---|
text-underline | text-decoration: underline | Links and emphasized references. |
text-overline | text-decoration: overline | Decorative typography. |
text-line-through | text-decoration: line-through | Deleted prices, unavailable items. |
text-no-decoration | text-decoration: none | Reset link decoration. |
Wrapping
| Class | CSS | Recommended use |
|---|---|---|
text-nowrap | white-space: nowrap | Prices, dates, labels, short button text. |
text-wrap | white-space: normal | Restore normal wrapping at a breakpoint or state. |
text-break | overflow-wrap: anywhere | Long URLs, tokens, file names, user-generated strings. |
text-pretty | text-wrap: pretty | Improve paragraph wrapping in supporting browsers. |
text-balance | text-wrap: balance | Balance heading lines for even visual distribution. |
Combined utilities
Utilities compose freely — pair transform, alignment, decoration, and wrapping on the same element.
<!-- Transform + muted -->
<span className="text-uppercase text-muted">Documentation</span>
<!-- Balance + center -->
<h1 className="text-center text-balance">
Build with utilities. Ship with components.
</h1>
<!-- Truncate + no decoration -->
<a href="#" className="text-truncate text-no-decoration">
Very long documentation link title
</a>
Choosing the right utility
| Use case | Recommended utility |
|---|---|
| Center content | text-center |
| Make label uppercase | text-uppercase |
| Remove link underline | text-no-decoration |
| Single-line ellipsis | text-truncate |
| Prevent wrapping | text-nowrap |
| Break long content | text-break |
| Improve paragraph wrap | text-pretty |
| Balance heading lines | text-balance |
Usage notes
- Use
text-startandtext-endfor writing-direction-aware layouts instead oftext-leftandtext-right. - Use
text-centerfor hero sections, empty states, and short display text — avoid on long body paragraphs. - Use
text-uppercasefor short labels and badges, not for long text blocks where legibility suffers. - Use
text-truncateonly when the container has a constrained width; otherwise it has no visible effect. - Use
text-breakfor long URLs, tokens, and user-generated strings that could break the layout. - Use
text-balancefor headings and short display text to even out line lengths across multiple lines. - Use
text-prettyfor paragraphs where supported — it prevents orphaned words at the end of lines. - Use Line Clamp utilities for multi-line truncation instead of
text-truncate.