0PricingLogin
Tailwind CSS Academy · Lesson

Text Color and Opacity

Apply text color utilities from Tailwind's color palette and adjust opacity to create hierarchy and contrast.

Tailwind's Color System

Tailwind ships a rich color palette: 22 colors like blue, indigo, red, and green, each with 11 shades from 50 (near-white) to 950 (near-black). Plenty to work with.

<!-- Tailwind color naming: {color}-{shade} -->
<p class="text-blue-500">Blue 500</p>
<p class="text-blue-700">Blue 700 (darker)</p>
<p class="text-blue-200">Blue 200 (lighter)</p>

Applying Text Color

Color text with text-{color}-{shade}. Low shades are light, mid are vivid, high are dark. text-gray-700 reads softly on white; text-gray-900 gives bold contrast.

<h1 class="text-gray-900">Main Heading</h1>
<h2 class="text-gray-700">Sub Heading</h2>
<p class="text-gray-600">Body text at a comfortable shade.</p>
<span class="text-gray-400">Metadata or secondary info</span>

All lessons in this course

  1. Font Size and Font Weight
  2. Text Color and Opacity
  3. Line Height and Letter Spacing
  4. Text Alignment and Decoration
← Back to Tailwind CSS Academy