Text Styling: Color, Alignment, and Decoration
You'll learn how to control text color, alignment, and decorative effects using Tailwind's utility classes.
What This Is
Now that you know how to set font family, size, and weight, it's time to polish your text with color, alignment, and decorative touches. Tailwind provides straightforward utilities that map directly to CSS properties you'd otherwise write manually—but with consistent naming and faster application.
Core Text Styling Utilities
Text Color
Use text-{color}-{shade} to set text color from Tailwind's palette:
<p class="text-gray-700">Default body text</p>
<h1 class="text-blue-600">Primary heading</h1>
<span class="text-red-500">Error message</span>
Text Alignment
Control horizontal alignment with text-left, text-center, text-right, or text-justify:
<p class="text-left">Aligned left (default)</p>
<p class="text-center">Centered text</p>
<p class="text-right">Aligned right</p>
Text Decoration
Add or remove underlines, overlines, and strikethroughs:
<a href="#" class="underline">Link with underline</a>
<p class="line-through">Strikethrough text</p>
<a href="#" class="no-underline">Link without underline</a>
Text Transform
Change capitalization with uppercase, lowercase, capitalize, or normal-case:
<p class="uppercase">all caps</p>
<p class="lowercase">ALL LOWERCASE</p>
<p class="capitalize">capitalize each word</p>
Think of it like: You're giving instructions to a typesetter—"make this blue," "center this," "underline that"—but using single-word commands instead of full sentences.
Key Takeaway: Tailwind's text-color-*, text-align, text-decoration, and text-transform utilities let you style text appearance quickly without writing custom CSS, keeping your markup expressive and consistent.