Discover how a simple class can transform your page titles instantly!
Why Display headings in Bootsrap? - Purpose & Use Cases
Imagine you want to make a webpage with different titles like "Welcome", "About Us", and "Contact" by typing each heading with different font sizes manually using CSS styles.
If you try to set font sizes and styles for each heading by hand, it takes a lot of time and you might make mistakes like inconsistent sizes or colors, making your page look messy and unprofessional.
Bootstrap provides ready-made heading classes that you can apply easily to your text. This means you get consistent, beautiful headings without writing extra CSS, saving time and avoiding errors.
<h1 style="font-size: 2.5rem; font-weight: bold;">Welcome</h1> <h2 style="font-size: 2rem; font-weight: bold;">About Us</h2>
<h1 class="display-1">Welcome</h1> <h2 class="display-2">About Us</h2>
Using Bootstrap display headings lets you create clear, stylish titles quickly that look great on all devices.
When building a company homepage, you can use Bootstrap display headings to make the main title and section titles stand out without extra CSS work.
Manually styling headings is slow and error-prone.
Bootstrap display headings provide easy, consistent styles.
This saves time and improves your webpage's look on any screen.
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
