Headings help organize content and show importance. They make pages easier to read and understand.
Display headings in Bootsrap
<h1 class="display-1">Heading 1</h1> <h2 class="display-2">Heading 2</h2> <h3 class="display-3">Heading 3</h3> <h4 class="display-4">Heading 4</h4>
Bootstrap provides display-1 to display-4 classes for large, stylish headings.
Use semantic tags like <h1> to <h6> for meaning, and add display classes for style.
display-1.<h1 class="display-1">Big Heading</h1>
display-2.<h2 class="display-2">Second Level Heading</h2>
display-3.<h3 class="display-3">Medium Heading</h3>
display-4.<h4 class="display-4">Smaller Heading</h4>
This page shows four headings with Bootstrap's display classes. Each heading is bigger and bolder than normal text, making them stand out clearly.
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Bootstrap Display Headings</title> <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet"> </head> <body> <main class="container mt-5"> <h1 class="display-1">Display 1 Heading</h1> <h2 class="display-2">Display 2 Heading</h2> <h3 class="display-3">Display 3 Heading</h3> <h4 class="display-4">Display 4 Heading</h4> </main> </body> </html>
Always use semantic heading tags (<h1> to <h6>) for accessibility and SEO.
Bootstrap's display classes make headings larger and more stylish without extra CSS.
Use container and spacing classes like container and mt-5 to keep layout neat and responsive.
Headings organize content and show importance on a webpage.
Bootstrap display classes display-1 to display-4 style headings with big, bold text.
Use semantic tags with display classes for good structure and style.
Practice
display-1 to display-4?Solution
Step 1: Understand Bootstrap display classes
Bootstrap display classes likedisplay-1todisplay-4are used to style headings with bigger and bolder text.Step 2: Identify the purpose of these classes
The main goal is to make headings stand out by increasing their size and weight, not to change colors or add animations.Final Answer:
To make headings larger and more prominent on the page -> Option DQuick Check:
Display classes = bigger, bold headings [OK]
- Thinking display classes change colors
- Confusing display classes with animation classes
- Assuming display classes hide elements
<h1> tag?Solution
Step 1: Recall Bootstrap class syntax
Bootstrap classes are added using theclassattribute with the exact class name, e.g.,class="display-3".Step 2: Check each option for correct syntax
<h1 class="display-3">Title</h1>usesclass="display-3"correctly. Other options misuse attribute syntax or class names.Final Answer:
<h1 class="display-3">Title</h1> -> Option CQuick Check:
Use class="display-x" for display headings [OK]
- Omitting the class attribute
- Writing class names without quotes
- Using incorrect attribute names
<h2 class="display-1">Big Heading</h2> <h2>Normal Heading</h2>
Solution
Step 1: Understand the effect of
Thedisplay-1classdisplay-1class makes text very large and bold compared to normal heading styles.Step 2: Compare the two headings visually
The first heading withdisplay-1will appear much bigger and bolder than the second heading without any display class.Final Answer:
The 'Big Heading' text will be much larger and bolder than 'Normal Heading'. -> Option AQuick Check:
display-1 = biggest heading style [OK]
- Assuming display classes do not change size
- Thinking normal headings are bigger
- Confusing display classes with visibility classes
<h3 class="display5">Heading</h3>
Solution
Step 1: Check Bootstrap display class naming
Bootstrap display classes use a dash, e.g.,display-1,display-2, up todisplay-4. There is nodisplay5class.Step 2: Identify the mistake in the code
The code usesdisplay5without a dash, which is invalid and will not apply the style.Final Answer:
The class name should be display-4 with a dash, not display5 -> Option BQuick Check:
Display classes require dash, e.g., display-1 [OK]
- Omitting the dash in class names
- Thinking display classes only work on <h1>
- Missing quotes around class attribute
Solution
Step 1: Understand Bootstrap display class sizes
Display classes range fromdisplay-1(largest) todisplay-4(smaller). There is nodisplay-5.Step 2: Choose correct class order for main and subheading
Main heading should usedisplay-1for biggest size, subheading can usedisplay-4for smaller but styled text.Step 3: Verify semantic tags and classes
<h1 class="display-1">Main Title</h1> <h2 class="display-4">Sub Title</h2>uses correct classes and semantic tags. Other combinations either use non-existent classes likedisplay-5, reverse the size order (smaller main heading withdisplay-4, larger subheading withdisplay-1), or omit display classes entirely.Final Answer:
<h1 class="display-1">Main Title</h1> <h2 class="display-4">Sub Title</h2> -> Option AQuick Check:
Main heading bigger with display-1, subheading smaller display-4 [OK]
- Using display classes in wrong size order
- Using non-existent display-5 class
- Not applying display classes to subheading
Ready to prove it?
Pass the test and this pattern moves unknown
