Bootstrap 5 Grid: Small Devices
The small tier (sm) starts at 576px — roughly a large phone in landscape or a small tablet. The xs tier below it has no infix at all: .col-6 is the "extra small" class, and it applies at every width.
| Tier | Infix | Range | Example classes |
|---|---|---|---|
| Extra small | (none) | 0 and up | .col, .col-6, .col-auto |
| Small | sm |
576px and up | .col-sm, .col-sm-6, .col-sm-auto |
Extra small columns
Classes without an infix never stack, which makes them ideal for small elements that should stay side by side even on the tiniest screen: icons, short labels, buttons.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
</head>
<body class="py-2">
<div class="container">
<div class="row text-center g-2">
<div class="col-3"><div class="border rounded py-2">🏠<br><small>Home</small></div></div>
<div class="col-3"><div class="border rounded py-2">🔍<br><small>Search</small></div></div>
<div class="col-3"><div class="border rounded py-2">❤️<br><small>Likes</small></div></div>
<div class="col-3"><div class="border rounded py-2">👤<br><small>Me</small></div></div>
</div>
</div>
</body>
</html>Small columns
With .col-sm-* columns are stacked below 576px and horizontal above. Here, a 25% / 75% split from sm up:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
</head>
<body class="py-2">
<div class="container">
<div class="row g-2">
<div class="col-sm-3"><div class="p-3 bg-warning-subtle border border-warning rounded h-100">col-sm-3<br><small>Filters</small></div></div>
<div class="col-sm-9"><div class="p-3 bg-info-subtle border border-info rounded">col-sm-9<br><small>Results</small></div></div>
</div>
</div>
<script>console.log(window.innerWidth >= 576 ? 'sm or wider: side by side' : 'xs: stacked');</script>
</body>
</html>Combining xs and sm
Give a column one size for phones and another from sm up. Below, each card is half-width on phones and a third from 576px:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
</head>
<body class="py-2">
<div class="container">
<div class="row g-2">
<div class="col-6 col-sm-4"><div class="card card-body p-2 small">col-6 col-sm-4</div></div>
<div class="col-6 col-sm-4"><div class="card card-body p-2 small">col-6 col-sm-4</div></div>
<div class="col-6 col-sm-4"><div class="card card-body p-2 small">col-6 col-sm-4</div></div>
<div class="col-6 col-sm-4"><div class="card card-body p-2 small">col-6 col-sm-4</div></div>
<div class="col-6 col-sm-4"><div class="card card-body p-2 small">col-6 col-sm-4</div></div>
<div class="col-6 col-sm-4"><div class="card card-body p-2 small">col-6 col-sm-4</div></div>
</div>
</div>
</body>
</html>Auto and equal-width at sm
.col-sm (no number) gives equal widths from sm up; .col-sm-auto sizes to the content. Combine them for a toolbar-style row:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
</head>
<body class="py-2">
<div class="container">
<div class="row g-2 align-items-center">
<div class="col-sm-auto"><span class="fw-bold">📋 Tasks</span></div>
<div class="col-sm"><input class="form-control form-control-sm" placeholder="Filter tasks…"></div>
<div class="col-sm-auto d-grid"><button class="btn btn-sm btn-primary">+ New</button></div>
</div>
</div>
</body>
</html>On phones the three pieces stack (with the button full-width thanks to d-grid); from 576px they line up in one row with the input taking the remaining space.
Note: You will usually see the sm (or larger) layout in the preview frame, since it's wider than 576px. Narrow your browser window to watch the stacked version, and drag the frame's bottom-right corner if you need more height.
Tip: The sm tier is mostly useful for small, compact components. Whole page layouts usually switch at md or lg, where there's room for real columns of text.
Test yourself
What is the infix for the extra-small tier?
- xs
- none — classes like .col-6 have no infix
- x
- sm
From which width does .col-sm-4 apply?
- 0px
- 576px
- 768px
- 992px
What does .col-sm-auto do from 576px up?
- Takes all remaining space
- Sizes the column to its content
- Hides the column
- Makes it 1/12 wide