Headings
Bootstrap styles h1 to h6 and gives matching .h1 to .h6 classes for any element.
In this page:
Syntax
<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
<!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
- Choosing heading tags for size only
- Skipping heading levels
- 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: