🎨 Bootstrap Text Styling Utilities
The Magic Paintbrush for Your Words
Imagine you have a magic paintbrush 🖌️ that can instantly change how your words look! That’s exactly what Bootstrap’s Text Styling Utilities are. Instead of painting on paper, you paint with special class names!
🎭 Typography Utilities
What Are They?
Typography utilities are like costume changes for your text. Just like actors wear different costumes for different scenes, your text can wear different “looks”!
Font Weight (How Bold?)
Think of font weight like muscles 💪 — some text is skinny, some is super buff!
<p class="fw-light">I'm thin like a stick</p>
<p class="fw-normal">I'm just right</p>
<p class="fw-bold">I'm STRONG!</p>
<p class="fw-bolder">I'm the STRONGEST!</p>
The Scale:
fw-lighter→ Like a whisperfw-light→ Gentle and softfw-normal→ Regular voicefw-semibold→ Getting seriousfw-bold→ Speaking loudlyfw-bolder→ SHOUTING!
Font Style (Straight or Tilted?)
Text can stand straight up or lean like it’s about to tell you a secret 🤫
<p class="fst-italic">I'm leaning over!</p>
<p class="fst-normal">I stand straight</p>
Line Height (Breathing Room)
Imagine lines of text as people standing in line. Line height is how much personal space they get!
<p class="lh-1">Packed tight</p>
<p class="lh-sm">A little space</p>
<p class="lh-base">Normal breathing</p>
<p class="lh-lg">Lots of room!</p>
✨ Text Decoration
Adding Flair to Your Words
Text decoration is like adding accessories to your outfit — a hat, a belt, or taking them off!
<a class="text-decoration-underline">
I have a line under me!
</a>
<a class="text-decoration-line-through">
I'm crossed out (oops!)
</a>
<a class="text-decoration-none">
I'm plain and clean
</a>
Real-Life Use:
| Class | What It Does | When to Use |
|---|---|---|
text-decoration-underline |
Adds a line below | Emphasize important text |
text-decoration-line-through |
Strikes through | Show deleted/old prices |
text-decoration-none |
Removes lines | Clean up link styles |
Pro Tip: Links automatically have underlines. Use text-decoration-none to remove them!
💻 Monospace Text
The Robot’s Typewriter
Monospace text is special — every letter takes the same amount of space. It’s like a robot typing where each key is exactly the same width!
<p class="font-monospace">
I look like computer code!
</p>
Why Use Monospace?
graph TD A["Monospace Text"] --> B["Code Snippets"] A --> C["Technical Data"] A --> D["Passwords"] A --> E["Phone Numbers"]
Example:
<p>Your code is:
<span class="font-monospace">ABC123</span>
</p>
Every letter in ABC123 is the same width, making it look professional and technical!
🔄 Text Reset
The Magic Eraser
Text Reset is like a magic eraser that removes the special styles a child element inherits from its parent. It’s saying “Forget everything, be yourself!”
<p class="text-muted">
This is gray text, but
<a href="#" class="text-reset">
I'm also gray (not blue)!
</a>
</p>
How It Works:
graph TD A["Parent Text Color"] --> B["Child Inherits Color"] B --> C["text-reset Applied"] C --> D["Child Matches Parent!"]
Without text-reset: Links would be blue (default). With text-reset: Links match parent’s color!
🌫️ Text Muted
The Quiet Voice
Text Muted makes your text whisper instead of shout. It’s softer, quieter, like background information that’s nice to know but not the main star!
<p>This is important text.</p>
<p class="text-muted">
This is a side note...
</p>
When to Use Muted Text:
- 📝 Help text under forms
- 📅 Timestamps and dates
- 💬 Secondary information
- 🔗 Less important captions
Example:
<h3>Sign Up Form</h3>
<input type="email" placeholder="Email">
<p class="text-muted">
We'll never share your email
</p>
🔗 Link Utilities
Dress Up Your Links
Links are like doors to other places. Link utilities help you decorate those doors!
Link Colors
<a href="#" class="link-primary">Blue door</a>
<a href="#" class="link-secondary">Gray door</a>
<a href="#" class="link-success">Green door</a>
<a href="#" class="link-danger">Red door</a>
<a href="#" class="link-warning">Yellow door</a>
<a href="#" class="link-info">Cyan door</a>
<a href="#" class="link-light">White door</a>
<a href="#" class="link-dark">Black door</a>
Link Underline Control
You can also control the underline behavior separately:
<!-- Underline only on hover -->
<a class="link-underline-opacity-0
link-underline-opacity-100-hover">
Secret underline!
</a>
Stretched Link
Make the entire parent container clickable:
<div class="card position-relative">
<h5>Click anywhere on this card</h5>
<a href="#" class="stretched-link">
Magic link
</a>
</div>
🎯 Quick Reference Table
| Utility | Purpose | Example Class |
|---|---|---|
| Font Weight | Make text bold/light | fw-bold |
| Font Style | Italic text | fst-italic |
| Line Height | Space between lines | lh-lg |
| Decoration | Underline/strikethrough | text-decoration-underline |
| Monospace | Computer-style font | font-monospace |
| Text Reset | Inherit parent color | text-reset |
| Text Muted | Softer gray text | text-muted |
| Link Colors | Colored links | link-primary |
🚀 Putting It All Together
Here’s a real example using multiple utilities:
<div class="card">
<h3 class="fw-bold">
Welcome Back!
</h3>
<p class="lh-lg">
Your last login was
<span class="font-monospace">
2 hours ago
</span>
</p>
<p class="text-muted fst-italic">
Remember to save your work
</p>
<a href="#" class="link-primary
text-decoration-none">
Continue →
</a>
</div>
🎉 You Did It!
You now know how to:
✅ Make text bold or light with font weight ✅ Create italic text with font style ✅ Add or remove underlines ✅ Use monospace for code-like text ✅ Reset link colors to match parents ✅ Create muted secondary text ✅ Style links with beautiful colors
Remember: These utilities are your magic paintbrush. Mix and match them to create beautiful, readable text that guides your users through your content!
🖌️ Now go paint your web pages with words!
