Discover how a few simple size labels can save you hours of frustrating CSS work!
Why Breakpoint tiers (xs, sm, md, lg, xl, xxl) in Bootsrap? - Purpose & Use Cases
Imagine you want your website to look good on phones, tablets, laptops, and big screens. You try to write separate styles for each screen size by guessing widths and changing CSS manually.
This manual way is slow and confusing. You might forget to update some styles or make mistakes that break the layout on certain devices. Testing every size takes forever.
Breakpoint tiers like xs, sm, md, lg, xl, and xxl in Bootstrap let you write styles that automatically adjust at set screen widths. You just pick the right tier and Bootstrap handles the rest.
@media (max-width: 600px) { .menu { font-size: 12px; } } @media (min-width: 601px) and (max-width: 900px) { .menu { font-size: 16px; } }
<div class="d-sm-none d-md-block">Content</div>
You can build flexible, responsive websites that look great on any device without writing complex media queries yourself.
A news website uses breakpoint tiers to show a simple menu on phones (xs), a bigger menu on tablets (sm), and a full navigation bar on desktops (md and up).
Manual screen size handling is slow and error-prone.
Breakpoint tiers provide easy, predefined screen widths.
They help create responsive designs that adapt smoothly.
Practice
Solution
Step 1: Understand Bootstrap breakpoint tiers
Bootstrap defines breakpoints for different screen sizes: xs, sm, md, lg, xl, and xxl.Step 2: Identify the smallest breakpoint
The smallest breakpoint isxs, which targets extra small devices like phones.Final Answer:
xs -> Option BQuick Check:
Extra small devices = xs [OK]
- Confusing xs with sm or md
- Thinking xl is for phones
- Assuming xs is deprecated
Solution
Step 1: Recall Bootstrap column classes
Bootstrap usescol-{breakpoint}-{number}to set column width at breakpoints.Step 2: Match medium breakpoint with 6 units
The classcol-md-6sets the column to span 6 units on medium (md) screens and larger.Final Answer:
col-md-6 -> Option DQuick Check:
Medium breakpoint + 6 units = col-md-6 [OK]
- Using col-xs-6 (deprecated)
- Choosing col-lg-6 for medium screens
- Using col-xxl-6 for medium screens
d-none d-lg-block on a div?Solution
Step 1: Understand the classes used
d-nonehides the element on all screen sizes by default.d-lg-blockmakes it display as block starting from large (lg) screens and above.Step 2: Combine effects on screen sizes
On screens smaller than large, the div is hidden. On large and bigger screens, it becomes visible as a block.Final Answer:
The div is visible only on large screens and above. -> Option CQuick Check:
d-none + d-lg-block = visible from lg up [OK]
- Thinking div is always hidden
- Assuming visible on small screens
- Confusing lg with md or xl
<div class='col-sm-4 col-md-6'></div> but on medium screens the column is still full width. What is the likely problem?Solution
Step 1: Check the class syntax
Bothcol-sm-4andcol-md-6are valid Bootstrap classes for different breakpoints.Step 2: Consider why styles don't apply
If the column is full width on medium screens, likely Bootstrap CSS is missing or not loaded, so classes have no effect.Final Answer:
You forgot to include Bootstrap's CSS file. -> Option AQuick Check:
Missing CSS means breakpoint classes don't work [OK]
- Assuming class syntax is wrong
- Thinking multiple breakpoints not allowed
- Adding wrong breakpoint class
Solution
Step 1: Understand width utility classes
w-100sets width to 100% (full width).w-md-autoresets width to auto starting at medium screens.Step 2: Match requirements
Full width on xs and sm meansw-100. On md and above, auto width withw-md-auto. Bootstrap does not havew-md-200or similar fixed pixel classes.Final Answer:
btn w-100 w-md-auto -> Option AQuick Check:
Full width xs/sm + auto width md+ = btn w-100 w-md-auto [OK]
- Using non-existent w-xs-100 or w-md-200 classes
- Confusing breakpoint suffixes
- Expecting fixed pixel widths from Bootstrap utilities
Ready to prove it?
Pass the test and this pattern moves unknown
