Text Spacing & Alignment: The Art of Giving Words Room to Breathe
Imagine you’re arranging guests at a dinner table. Too close? Awkward. Too far? Lonely. Just right? Perfect conversation!
The Big Picture
Text isn’t just about what you say—it’s about how it looks on the page. Think of your words like a garden:
- Letter spacing = how close the flowers are planted
- Line height = how tall the fences between rows
- Text alignment = which side of the garden path everything grows
- Text indent = the little walkway at the start of each row
- Responsive typography = making sure it looks great whether you’re looking at a tiny phone or a big TV
Let’s make your text beautiful!
1. Letter Spacing (Tracking)
What Is It?
Letter spacing controls the space between letters. Like spreading out cards on a table!
T I G H T ← letters squeezed together
W I D E ← letters spread apart
Tailwind Classes
| Class | Spacing | When to Use |
|---|---|---|
tracking-tighter |
-0.05em | Tight headlines |
tracking-tight |
-0.025em | Slightly compact |
tracking-normal |
0 | Regular text |
tracking-wide |
0.025em | Elegant spacing |
tracking-wider |
0.05em | All caps text |
tracking-widest |
0.1em | Special titles |
Example
<h1 class="tracking-widest">
WELCOME
</h1>
<p class="tracking-normal">
Regular paragraph text
</p>
Pro Tip
Use tracking-wider or tracking-widest for ALL CAPS text—it makes uppercase letters easier to read!
2. Line Height (Leading)
What Is It?
Line height is the vertical space between lines of text. Think of it like the gap between rungs on a ladder!
Line one
(small gap) ← tight line height
Line two
Line one
(big gap) ← loose line height
Line two
Tailwind Classes
| Class | Value | Best For |
|---|---|---|
leading-none |
1 | Single-line headings |
leading-tight |
1.25 | Headlines |
leading-snug |
1.375 | Subheadings |
leading-normal |
1.5 | Body text |
leading-relaxed |
1.625 | Easy reading |
leading-loose |
2 | Extra breathing room |
Fixed Line Heights
Need exact control? Use fixed values:
| Class | Height |
|---|---|
leading-3 |
12px |
leading-4 |
16px |
leading-5 |
20px |
leading-6 |
24px |
leading-7 |
28px |
leading-8 |
32px |
Example
<p class="leading-relaxed">
This paragraph has comfortable
spacing between lines. Your eyes
can travel smoothly!
</p>
The Rule of Thumb
Body text loves leading-relaxed (1.625). Headlines prefer leading-tight (1.25).
3. Text Alignment
What Is It?
Text alignment decides which edge your words line up against. Like choosing which side of the road to walk on!
Tailwind Classes
| Class | Effect | Visual |
|---|---|---|
text-left |
Aligns left | Text here____ |
text-center |
Centers text | __Text here__ |
text-right |
Aligns right | ____Text here |
text-justify |
Stretches evenly | Text--here--! |
text-start |
Language-aware left | Adapts to RTL |
text-end |
Language-aware right | Adapts to RTL |
Example
<h1 class="text-center">
Centered Title
</h1>
<p class="text-left">
Left-aligned paragraph for
easy reading.
</p>
<p class="text-right">
Right-aligned for special
effects or RTL languages.
</p>
When to Use What?
- Left = Most body text (easiest to read)
- Center = Headlines, buttons, cards
- Right = Prices, dates, special layouts
- Justify = Newspapers, formal documents
4. Text Indent
What Is It?
Text indent pushes the first line of a paragraph inward. Like the little tab you press when starting a new paragraph in a book!
This first line is indented.
The rest flows normally along
the left edge of the container.
Tailwind Classes
| Class | Indent |
|---|---|
indent-0 |
0px |
indent-px |
1px |
indent-1 |
4px |
indent-2 |
8px |
indent-4 |
16px |
indent-8 |
32px |
indent-16 |
64px |
Example
<p class="indent-8">
This paragraph has a nice
indent at the start. It
looks like a classic book!
</p>
Fun Trick: Negative Indent
<p class="indent-[-20px] pl-5">
Hanging indent! First line
sticks out, rest tucked in.
</p>
This creates a hanging indent—perfect for bullet points or bibliographies!
5. Responsive Typography
What Is It?
Different screens need different text styles! A phone needs smaller text than a TV. Responsive typography makes your text adapt automatically.
The Magic Prefixes
| Prefix | Screen Width | Device |
|---|---|---|
| (none) | 0px+ | Mobile (default) |
sm: |
640px+ | Large phones |
md: |
768px+ | Tablets |
lg: |
1024px+ | Laptops |
xl: |
1280px+ | Desktops |
2xl: |
1536px+ | Big screens |
Example: Responsive Text Size
<h1 class="text-xl
md:text-3xl
lg:text-5xl">
I Grow Bigger!
</h1>
- Phone: Extra large (xl)
- Tablet: 3x large (3xl)
- Desktop: 5x large (5xl)
Example: Responsive Alignment
<p class="text-center
md:text-left">
Centered on mobile,
left-aligned on tablets!
</p>
Example: Responsive Line Height
<p class="leading-snug
lg:leading-relaxed">
Tighter on mobile,
roomier on big screens!
</p>
Example: Responsive Letter Spacing
<h1 class="tracking-normal
md:tracking-wide">
ELEGANT TITLE
</h1>
Putting It All Together
Here’s a beautiful, responsive text block:
<article class="p-4">
<h1 class="text-2xl md:text-4xl
tracking-tight
leading-none
text-center md:text-left">
Beautiful Headlines
</h1>
<p class="mt-4
text-base md:text-lg
leading-relaxed
indent-4
text-justify md:text-left">
Your paragraph text here.
Comfortable to read on any
screen size!
</p>
</article>
Quick Reference Flow
graph TD A[Text Spacing & Alignment] --> B[Letter Spacing] A --> C[Line Height] A --> D[Text Alignment] A --> E[Text Indent] A --> F[Responsive] B --> B1[tracking-tight] B --> B2[tracking-wide] C --> C1[leading-tight] C --> C2[leading-relaxed] D --> D1[text-left/center/right] D --> D2[text-justify] E --> E1[indent-4/8/16] F --> F1[sm: md: lg: xl:]
Summary: The Golden Rules
| Property | Mobile | Desktop | Why |
|---|---|---|---|
| Letter Spacing | Normal | Wider for caps | Readability |
| Line Height | Snug | Relaxed | Comfort |
| Alignment | Center | Left | Thumb reach |
| Indent | Small | Medium | Proportions |
You Did It!
Now you can:
- Make letters breathe with
tracking-* - Give lines room with
leading-* - Align text perfectly with
text-* - Create book-style indents with
indent-* - Make it all responsive with
sm:,md:,lg:
Your text will look professional on every device. Happy styling!