Skip to main content
Bootstrap
CHAPTER 04 Beginner

Typography and Text Utilities

Updated: May 18, 2026
5 min read

# CHAPTER 4

Typography and Text Utilities

1. Chapter Introduction

Typography is the art of making text readable and beautiful. Bootstrap ships with a complete typographic system: heading classes, display text for hero sections, lead paragraphs, and dozens of utility classes for alignment, weight, color, and transformation — all without writing a single line of custom CSS.

2. Learning Objectives

  • Use heading classes (.h1.h6) and display classes.
  • Apply .lead for emphasized intro text.
  • Control text alignment, weight, and style.
  • Transform text with text-transform utilities.
  • Truncate, wrap, and break text.

3. Headings

html
1234567891011
<!-- Standard HTML headings — Bootstrap styles them consistently -->
<h1>Heading 12.5rem, bold</h1>
<h2>Heading 2 — 2rem, bold</h2>
<h3>Heading 31.75rem, bold</h3>
<h4>Heading 41.5rem, bold</h4>
<h5>Heading 51.25rem, bold</h5>
<h6>Heading 6 — 1rem, bold</h6>

<!-- Heading CLASSES on non-heading elements -->
<p class="h1">Looks like H1 but is a paragraph</p>
<div class="h3">Looks like H3 but is a div</div>

4. Display Headings (Hero Text)

Display headings are larger, bolder versions for hero sections:
html
123456
<h1 class="display-1">Display 1 — 5rem</h1>
<h1 class="display-2">Display 24.5rem</h1>
<h1 class="display-3">Display 3 — 4rem</h1>
<h1 class="display-4">Display 43.5rem</h1>
<h1 class="display-5">Display 5 — 3rem</h1>
<h1 class="display-6">Display 62.5rem</h1>

5. Lead Text and Inline Elements

html
1234567891011121314151617181920
<!-- Lead: larger, lighter paragraph for introductions -->
<p class="lead">A lead paragraph stands out from regular body text, making it perfect for introductions.</p>

<!-- Inline text styling -->
<p>
  <strong>Bold text</strong> — for emphasis<br />
  <em>Italic text</em> — for tone<br />
  <mark>Highlighted text</mark> — yellow background<br />
  <del>Deleted text</del> — strikethrough<br />
  <ins>Inserted text</ins> — underline<br />
  <small>Small text</small> — 85% size<br />
  <abbr title="HyperText Markup Language">HTML</abbr> — tooltip on hover<br />
  <code>inline code</code> — monospace font
</p>

<!-- Blockquote -->
<blockquote class="blockquote">
  <p>"The best way to predict the future is to invent it."</p>
  <footer class="blockquote-footer">Alan Kay</footer>
</blockquote>

6. Text Alignment

html
123456789
<!-- Horizontal alignment -->
<p class="text-start">Left aligned (default)</p>
<p class="text-center">Center aligned</p>
<p class="text-end">Right aligned</p>

<!-- Responsive alignment -->
<p class="text-start text-md-center text-lg-end">
  Left on mobile, center on tablet, right on desktop
</p>

7. Font Weight and Style

html
1234567891011121314
<p class="fw-bold">Bold text (font-weight: 700)</p>
<p class="fw-bolder">Bolder (relative to parent)</p>
<p class="fw-semibold">Semibold (font-weight: 600)</p>
<p class="fw-medium">Medium (font-weight: 500)</p>
<p class="fw-normal">Normal (font-weight: 400)</p>
<p class="fw-light">Light (font-weight: 300)</p>
<p class="fw-lighter">Lighter (relative to parent)</p>

<p class="fst-italic">Italic text</p>
<p class="fst-normal">Normal style</p>

<p class="text-decoration-underline">Underlined</p>
<p class="text-decoration-line-through">Strikethrough</p>
<p class="text-decoration-none">No decoration</p>

8. Text Transformation

html
123
<p class="text-lowercase">CONVERTED to lowercase</p>
<p class="text-uppercase">converted to UPPERCASE</p>
<p class="text-capitalize">each word capitalized</p>

9. Text Colors

html
1234567891011
<p class="text-primary">Primary blue</p>
<p class="text-secondary">Secondary gray</p>
<p class="text-success">Success green</p>
<p class="text-danger">Danger red</p>
<p class="text-warning">Warning yellow</p>
<p class="text-info">Info cyan</p>
<p class="text-light bg-dark">Light on dark</p>
<p class="text-dark">Dark text</p>
<p class="text-body">Default body color</p>
<p class="text-muted">Muted gray text</p>
<p class="text-white bg-primary">White text</p>

10. Text Overflow and Wrapping

html
123456789101112131415161718
<!-- Truncate long text with ellipsis -->
<p class="text-truncate" style="max-width: 200px;">
  This is a very long text that will be truncated...
</p>

<!-- Prevent text wrapping -->
<p class="text-nowrap">This text will not wrap to a new line</p>

<!-- Break long words -->
<p class="text-break">VeryLongWordWithoutSpacesThatWouldOverflowContainer</p>

<!-- Font size utilities -->
<p class="fs-1">fs-1 (2.5rem)</p>
<p class="fs-2">fs-2 (2rem)</p>
<p class="fs-3">fs-3 (1.75rem)</p>
<p class="fs-4">fs-4 (1.5rem)</p>
<p class="fs-5">fs-5 (1.25rem)</p>
<p class="fs-6">fs-6 (1rem)</p>

11. Common Mistakes

  • Using display classes without semantic headings: <div class="display-1"> is semantically wrong. Use <h1 class="display-1"> or at minimum add an ARIA role.
  • Combining fw-bold with fst-italic: These can be combined freely — class="fw-bold fst-italic".

12. MCQs

Question 1

What class creates emphasized intro paragraph text?

Question 2

What is the range of Bootstrap display heading classes?

Question 3

What class aligns text to the right?

Question 4

What class makes text bold?

Question 5

What utility converts text to uppercase?

Question 6

What does .text-truncate require to work?

Question 7

What class applies monospace font styling?

Question 8

What Bootstrap class sets font size to 1.5rem?

Question 9

What class makes text color the Bootstrap "muted" gray?

Question 10

How do you center text only on tablet and above?

13. Interview Questions

  • Q: What is the difference between Bootstrap's .h1 class and the <h1> element?
  • Q: How would you make text responsive — different alignments on different screen sizes?

14. Summary

Bootstrap's typography system handles every text need: headings, display text, inline elements, alignment, weight, size, color, and overflow. These utility classes eliminate the need for custom CSS for 99% of text styling tasks.

15. Next Chapter Recommendation

In Chapter 5: Colors, Backgrounds, and Borders, we explore Bootstrap's full theme color system, background utilities, border customization, shadows, and opacity classes.

Finish this Chapter

Save your progress on your learning path and prepare for coding interview challenges.

Discussion

Join the discussion

Log in or create a free account to participate.

Sort: ·