Layout
Columns
Size, auto-size, offset, or set how many columns fit per row.
| Class | What it does |
|---|---|
.col | Equal width — shares the row with other .cols |
.col-1 … .col-12 | Span that many of 12 columns |
.col-auto | As wide as its content |
.offset-1 … .offset-11 | Push the column right by that many columns |
.row-cols-1 … .row-cols-6 | On the row: each child takes 1/n of the width |
.row-cols-auto | On the row: every child sized to its content |
All of them work with every breakpoint prefix: md:col-4, lg:offset-2, sm:row-cols-2.
col-8
col-4
col-auto
col
col-4 offset-4
<div class="row">
<div class="col-8">…</div>
<div class="col-4">…</div>
<div class="col-auto">…</div>
<div class="col">…</div>
<div class="col-4 offset-4">…</div>
</div>
Columns per row — set it once on the row instead of on every column:
<div class="row row-cols-2 md:row-cols-4">
<div>…</div> <div>…</div> <div>…</div> <div>…</div>
</div>
Columns per row
Two per row on phones, four on tablets and up — set once on the row.
1
2
3
4
5
6
<div class="row row-cols-2 md:row-cols-4">
<div>…</div> <div>…</div> …
</div>
Fixed and flexible
col-auto takes only what it needs; col fills the rest — handy for a search bar with a button.
<div class="row g-2">
<div class="col">
<input class="form-control" placeholder="Search orders" aria-label="Search orders">
</div>
<div class="col-auto"><button class="btn btn-default">Search</button></div>
</div>
Centered with an offset
md:col-6 md:offset-3
<div class="row">
<div class="col-12 md:col-6 md:offset-3">
<div class="cell">md:col-6 md:offset-3</div>
</div>
</div>