← Back to Bootstrap Course | Chapter 3: Typography | Lesson 1 of 7

Headings

Bootstrap styles h1 to h6 and gives matching .h1 to .h6 classes for any element.

In this page:

  1. Headings
Syntax
markup
<h1>Heading</h1>
<p class="h3">Looks like h3</p>

Headings

The tags h1 to h6 get consistent sizes and margins. When you need heading looks on other elements, use .h1 to .h6. Add small text inside a heading with the .small class or a small tag for a muted, smaller subtitle.

Note: Keep semantic order (h1 then h2) and change the look with classes.

Example: Headings

markup
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet">
</head>
<body class="p-3">
<div class="container">
  <h1>h1. Heading <small class="text-body-secondary">with muted subtitle</small></h1>
  <h3>h3. Heading</h3>
  <p class="h2">A paragraph styled like h2</p>
  <h6>h6. Heading</h6>
</div>
</body>
</html>
Live Example
Related Topics
Common Mistakes
  1. Choosing heading tags for size only
  2. Skipping heading levels
  3. Using several h1 elements
Chapter Summary
  • h1 to h6 are styled
  • .h1 to .h6 style any element
  • Use small for subtitles
  • Keep semantic order
🔒

Chapter Quiz — Complete all 7 topics to unlock

0/7 topics done

Complete these topics first:

Login to run this code

C/C++/Java/PHP execution requires a free account. Your code is saved — you'll land right back in the editor after logging in.