Typography forms the backbone of digital communication. Bootstrap 5 provides a modern, clean typography scale built on modern system font stacks (San Francisco, Segoe UI, Roboto, and Helvetica Neue). It features Responsive Font Sizing (RFS), ensuring your headings scale smoothly down on mobile viewports to prevent awkward line breaks and layout overflow.
<h1> through <h6>)Bootstrap normalizes all HTML heading elements, providing standardized rem font sizes, tight line heights, and margin resets. You can also use heading classes (.h1 through .h6) to visually style non-heading elements without altering semantic heading hierarchy:
| Heading Element | Computed Desktop Font Size | Visual Preview |
|---|---|---|
<h1> or .h1 |
2.5rem (40px) | h1. Bootstrap Heading |
<h2> or .h2 |
2.0rem (32px) | h2. Bootstrap Heading |
<h3> or .h3 |
1.75rem (28px) | h3. Bootstrap Heading |
<h4> or .h4 |
1.5rem (24px) | h4. Bootstrap Heading |
<h5> or .h5 |
1.25rem (20px) | h5. Bootstrap Heading |
<h6> or .h6 |
1.0rem (16px) | h6. Bootstrap Heading |
.display-1 through .display-6)When building hero banners, landing page headers, or portfolio showcases, traditional headings may feel too understated. Bootstrap 5 provides six high-impact Display Headings with larger font sizes, thinner font weights, and graceful responsive scaling:
<h1 class="display-1">Display 1 (5rem / 80px)</h1>
<h1 class="display-2">Display 2 (4.5rem / 72px)</h1>
<h1 class="display-3">Display 3 (4rem / 64px)</h1>
<h1 class="display-4">Display 4 (3.5rem / 56px)</h1>
<h1 class="display-5">Display 5 (3rem / 48px)</h1>
<h1 class="display-6">Display 6 (2.5rem / 40px)</h1>
To make your opening introductory paragraph stand out, apply the .lead class. It increases the font size (1.25rem) and reduces font weight (300):
<!-- Lead introductory paragraph -->
<p class="lead">
Bootstrap 5 is designed to help students, designers, and developers build clean, mobile-first websites faster than ever.
</p>
<!-- Inline text utilities -->
<p>You can use <mark>highlight text</mark> with mark class.</p>
<p><del>This text is treated as deleted.</del></p>
<p><ins>This line is an extra insertion.</ins></p>
<p><small class="text-body-secondary">Fine print / disclaimers using small class.</small></p>
Quotes from articles, customer testimonials, or academic references should be wrapped in semantic <blockquote> tags using the .blockquote class:
<figure>
<blockquote class="blockquote">
<p>"Good design is as little design as possible."</p>
</blockquote>
<figcaption class="blockquote-footer">
Dieter Rams in <cite title="Source Title">Ten Principles for Good Design</cite>
</figcaption>
</figure>
Bootstrap 5 ships with RFS (Responsive Font Sizing) enabled by default in Sass. RFS dynamically calculates font sizes using CSS clamp() and calc() functions, allowing font sizes to smoothly adapt between a minimum mobile size and a maximum desktop size without requiring dozens of manual media queries!
Strengthen your responsive web design mastery by studying these connected classes:
Style typography with contextual text colors, opacity, and backgrounds.
Format tabular data with clean typography and contextual styles.
Create attractive call-to-action buttons with custom typography.
Ensure text contrast ratios, readable line heights, and screen reader labels.
<h1> is a semantic HTML heading with a font size of 2.5rem (40px) and bold font weight (500). .display-1 is a visual presentation class with a massive font size of 5rem (80px) and lighter font weight (300), typically used for hero banners.
system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', 'Noto Sans', 'Liberation Sans', Arial, sans-serif. This provides instant rendering speeds because zero web font files need to be downloaded.
.text-truncate class. It sets overflow: hidden; text-overflow: ellipsis; white-space: nowrap; to safely truncate text with an ellipsis on a single line.
Advance your practical frontend engineering skills with the next topic in our synchronized curriculum.
Continue to Class 9: Colors & Backgrounds → Previous: ← Class 7: Native CSS Grid | Full Syllabus