What is a common mistake when using Bootstrap grid system?
Not placing .col- classes inside a .row container. This breaks the layout because Bootstrap grid requires columns to be direct children of rows.
Click to reveal answer
beginner
Why should you avoid mixing Bootstrap versions in one project?
Different Bootstrap versions have different class names and behaviors. Mixing them causes conflicts and unpredictable styling issues.
Click to reveal answer
beginner
What happens if you forget to include Bootstrap's JavaScript file when using components like modals or dropdowns?
Interactive components won't work because Bootstrap's JavaScript handles their behavior. You must include the JS file and dependencies like Popper.js.
Click to reveal answer
intermediate
Why is it important to use Bootstrap's responsive classes properly?
Using responsive classes incorrectly can cause layout issues on different screen sizes. For example, not specifying breakpoints can make content look bad on phones or tablets.
Click to reveal answer
intermediate
What is a common mistake related to customizing Bootstrap styles?
Overriding Bootstrap CSS directly without using custom CSS files or variables can make updates difficult and cause conflicts.
Click to reveal answer
Which Bootstrap class should always wrap .col- classes?
A<code>.row</code>
B<code>.container</code>
C<code>.grid</code>
D<code>.section</code>
✗ Incorrect
Bootstrap grid columns (.col-) must be direct children of a .row to work properly.
What is needed for Bootstrap dropdowns to function correctly?
AOnly Bootstrap CSS
BBootstrap CSS and JavaScript
COnly JavaScript
DNo files needed
✗ Incorrect
Bootstrap dropdowns require both CSS for styling and JavaScript for interactive behavior.
What can happen if you mix Bootstrap 4 and Bootstrap 5 classes in one project?
AAutomatic upgrade
BNo effect
CBetter performance
DConflicts and broken styles
✗ Incorrect
Mixing versions causes conflicts because class names and behaviors differ between versions.
Which is a good practice when customizing Bootstrap styles?
AEdit Bootstrap CSS files directly
BUse inline styles everywhere
CUse custom CSS files or Sass variables
DAvoid any customization
✗ Incorrect
Using custom CSS or Sass variables keeps Bootstrap updates safe and your styles organized.
Why should you use Bootstrap's responsive classes carefully?
ATo ensure layout adapts well on all devices
BTo make the site slower
CTo avoid using media queries
DTo disable responsiveness
✗ Incorrect
Proper use of responsive classes ensures your site looks good on phones, tablets, and desktops.
Explain why Bootstrap grid columns must be inside a .row and what happens if they are not.
Think about how Bootstrap arranges columns horizontally.
You got /3 concepts.
Describe the importance of including Bootstrap's JavaScript file when using interactive components.
CSS styles alone are not enough for dropdown menus.
You got /3 concepts.
Practice
(1/5)
1. Which of the following is a common mistake when using Bootstrap buttons?
easy
A. Adding both btn and btn-primary classes together
B. Using btn-primary without the base btn class
C. Using btn class alone without any color class
D. Using btn-secondary for a secondary button
Solution
Step 1: Understand Bootstrap button class structure
Bootstrap buttons require the base class btn plus a style class like btn-primary to work properly.
Step 2: Identify the mistake in the options
Using btn-primary alone without btn will not style the button correctly.
Final Answer:
Using btn-primary without the base btn class -> Option B
Quick Check:
Always combine btn with style classes [OK]
Hint: Always include base btn class with button styles [OK]
Common Mistakes:
Forgetting the base btn class
Using incorrect class names
Mixing Bootstrap 3 and 5 classes
2. Which of the following is the correct syntax to create a responsive Bootstrap grid row with three equal columns?
easy
A. <div class='row'><div class='col'>...</div><div class='col'>...</div><div class='col'>...</div></div>
B. <div class='row'><div class='col-6'>...</div><div class='col-6'>...</div><div class='col-6'>...</div></div>
C. <div class='container'><div class='col-4'>...</div><div class='col-4'>...</div><div class='col-4'>...</div></div>
D. <div class='row'><div class='col-3'>...</div><div class='col-3'>...</div><div class='col-3'>...</div></div>
Solution
Step 1: Recall Bootstrap grid basics
Bootstrap grid uses rows and columns. Using col without a number divides space equally among columns.
Step 2: Check each option
<div class='row'><div class='col'>...</div><div class='col'>...</div><div class='col'>...</div></div> uses col three times inside a row, which creates three equal columns responsively.
Final Answer:
Using col inside a row for equal columns -> Option A
Quick Check:
Equal columns = col inside row [OK]
Hint: Use col for equal columns inside a row [OK]
Common Mistakes:
Using col-4 without a row
Missing the row container
Using wrong column widths that don't add to 12
3. What will be the visual result of this Bootstrap code snippet?
C. Using data-toggle and data-target instead of data-bs-toggle and data-bs-target
D. Missing container class instead of container-fluid
Solution
Step 1: Check Bootstrap 5 data attribute syntax
Bootstrap 5 changed data-toggle and data-target to data-bs-toggle and data-bs-target.
Step 2: Identify the error in the snippet
The snippet uses old Bootstrap 4 attributes data-toggle and data-target, which won't work in Bootstrap 5.
Final Answer:
Using data-toggle and data-target instead of data-bs-toggle and data-bs-target -> Option C
Quick Check:
Bootstrap 5 requires data-bs-* attributes [OK]
Hint: Use data-bs-toggle and data-bs-target in Bootstrap 5 [OK]
Common Mistakes:
Using Bootstrap 4 data attributes in Bootstrap 5
Forgetting to include Bootstrap JS for toggler
Incorrect container class usage
5. You want a Bootstrap card component that always stays centered horizontally on all screen sizes and has a maximum width of 24rem. Which combination of classes and styles avoids common mistakes?
hard
A. <div class='card' style='width: 24rem; margin: auto;'>...</div>
B. <div class='card text-center' style='width: 24rem;'>...</div>
C. <div class='card mx-auto' style='width: 24rem;'>...</div>
D. <div class='card mx-auto' style='max-width: 24rem;'>...</div>
Solution
Step 1: Understand horizontal centering in Bootstrap
Using mx-auto applies automatic horizontal margins, centering the element inside its container.
Step 2: Use max-width for responsive sizing
Setting max-width: 24rem; limits the card's width but allows it to shrink on smaller screens, avoiding overflow.
Step 3: Evaluate options
<div class='card mx-auto' style='max-width: 24rem;'>...</div> uses mx-auto and max-width, which is the best practice to center and limit width responsively.
Final Answer:
<div class='card mx-auto' style='max-width: 24rem;'>...</div> -> Option D
Quick Check:
Center with mx-auto and limit width with max-width [OK]
Hint: Use mx-auto and max-width for centered responsive cards [OK]
Common Mistakes:
Using fixed width without max-width causing overflow
Using text-center which centers text, not the card
Forgetting horizontal margin auto for centering
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.