📏 Bootstrap 5 – Grid XSmall (xs
) – Layout Without Prefix
🧲 Introduction – What Is the XSmall Grid in Bootstrap 5?
In Bootstrap 5, XSmall (xs
) refers to the extra small breakpoint, which covers all devices less than 576px wide. Unlike other breakpoints, the xs
variant has no class prefix—it applies by default. This is the foundation of Bootstrap’s mobile-first grid system.
🎯 In this guide, you’ll learn:
- How
xs
works by default without prefixes - How to structure layouts that target extra small screens
- Code examples using only
.col-*
(without breakpoint) - Best practices for small screen-first design
🧱 How Bootstrap Treats XSmall (xs
)
Breakpoint | Abbreviation | Min Width | Class Prefix |
---|---|---|---|
Extra small | xs | <576px | (None) |
🔍 Meaning:
- If you use
.col-6
, it means “apply 50% width on all screens starting fromxs
(i.e., all sizes).” - To change layout at specific sizes, you use
sm
,md
, etc.
✅ Example – 2 Equal Columns on All Screens (XSmall by Default)
<div class="row">
<div class="col-6 bg-primary text-white p-2">Column A</div>
<div class="col-6 bg-success text-white p-2">Column B</div>
</div>
🔍 Explanation:
col-6
splits the row into 2 equal parts.- Since there’s no
-sm
,-md
, etc., this layout applies from extra small upward.
✅ Example – Full Width Columns (Stacked)
<div class="row">
<div class="col-12 bg-info text-white p-2">Stacked A</div>
<div class="col-12 bg-dark text-white p-2">Stacked B</div>
</div>
🔍 Explanation:
- Both columns span full width (
12/12
) regardless of screen size.
✅ Example – Mobile-First with Breakpoint Upgrade
<div class="row">
<div class="col-12 col-sm-6 bg-warning p-3">Responsive A</div>
<div class="col-12 col-sm-6 bg-secondary text-white p-3">Responsive B</div>
</div>
🔍 Explanation:
col-12
: Full width onxs
col-sm-6
: 50% width starting from small (≥576px
)
✔️ Great for stacking on phones and splitting on tablets.
🛠️ Best Practices for XSmall Grid
Tip | Why It’s Important |
---|---|
Use .col-* without breakpoint prefixes | Automatically targets the xs breakpoint |
Design for mobile-first | Ensures better UX on smallest screens |
Use padding/margin utilities (p-* , m-* ) | Prevents content crowding on mobile |
Minimize columns per row | Stacked columns improve readability on xs |
Use responsive classes for override | Combine col-12 with col-md-* for scaling |
📌 Summary – XSmall Grid Behavior in Bootstrap 5
The XSmall Grid in Bootstrap 5 is the default mobile layout. You don’t need to specify any class prefix—col-6
, col-12
, etc., automatically apply to xs
screens and above. Use this for mobile-first layouts that stack or scale up progressively.
🔍 Key Takeaways:
.col-*
without breakpoint = applies toxs
by defaultxs
is for screens<576px
(like phones in portrait mode)- Combine
col-12
+col-sm-*
for stacked-to-horizontal layouts - XSmall design is key to responsive UX and loading speed
⚙️ Bootstrap 5’s mobile-first grid starts with xs
—optimize it well and scale upward as needed.
❓ FAQs – Bootstrap 5 Grid XSmall
❓ What is the default breakpoint in Bootstrap 5?
✅ Extra small (xs
) is the default and doesn’t require a class prefix.
❓ Is col-xs-*
a valid class in Bootstrap 5?
❌ No. Bootstrap 5 removed the xs
prefix—use col-*
instead.
❓ How do I target only xs
screens?
✅ Use col-12
or media queries (max-width: 575.98px
) in custom CSS.
❓ How does Bootstrap handle stacking on mobile?
✅ Columns automatically stack unless defined otherwise using breakpoints (col-sm-*
, etc.).
Share Now :