Grid
Use our powerful mobile-first flexbox grid to build layouts of all shapes and sizes thanks to a twelve column system, six default responsive tiers, Sass variables and mixins, and dozens of predefined classes.
Grid on Bootstrap<div class="table-responsive scrollbar">
<table class="table table-bordered table-striped mb-0">
<thead>
<tr>
<th></th>
<th class="text-center">Extra small<br /><small><576px</small></th>
<th class="text-center">Small<br /><small>≥576px</small></th>
<th class="text-center">Medium<br /><small>≥768px</small></th>
<th class="text-center">Large<br /><small>≥992px</small></th>
<th class="text-center">Extra large<br /><small>≥1200px</small></th>
<th class="text-center">Massive<br /><small>≥1400px</small></th>
</tr>
</thead>
<tbody>
<tr>
<th class="text-nowrap" scope="row">Max container width</th>
<td>None (auto)</td>
<td>540px</td>
<td>720px</td>
<td>960px</td>
<td>1140px</td>
<td>1320px</td>
</tr>
<tr>
<th class="text-nowrap" scope="row">Class prefix</th>
<td><code>.col-</code></td>
<td><code>.col-sm-</code></td>
<td><code>.col-md-</code></td>
<td><code>.col-lg-</code></td>
<td><code>.col-xl-</code></td>
<td><code>.col-xxl-</code></td>
</tr>
<tr>
<th class="text-nowrap" scope="row"># of columns</th>
<td colspan="6">12</td>
</tr>
<tr>
<th class="text-nowrap" scope="row">Gutter width</th>
<td colspan="6">30px (15px on each side of a column)</td>
</tr>
<tr>
<th class="text-nowrap" scope="row">Nestable</th>
<td colspan="6">Yes</td>
</tr>
<tr>
<th class="text-nowrap" scope="row">Column ordering</th>
<td colspan="6">Yes</td>
</tr>
</tbody>
</table>
</div>
<div class="container text-center">
<div class="row bg-body-highlight mb-3">
<div class="col p-2 border">1 of 2</div>
<div class="col p-2 border">2 of 2</div>
</div>
<div class="row bg-body-highlight">
<div class="col p-2 border">1 of 3</div>
<div class="col p-2 border">2 of 3</div>
<div class="col p-2 border">3 of 3</div>
</div>
</div>
Column width
Auto-layout for flexbox grid columns also means you can set the width of one column and have the sibling columns automatically resize around it. You may use predefined grid classes (as shown below), grid mixins, or inline widths. Note that the other columns will resize no matter the width of the center column.
<div class="container text-center">
<div class="row bg-body-highlight mb-3">
<div class="col p-2 border">1 of 3</div>
<div class="col-6 p-2 border">2 of 3 (wider)</div>
<div class="col p-2 border">3 of 3</div>
</div>
<div class="row bg-body-highlight">
<div class="col p-2 border">1 of 3</div>
<div class="col-5 p-2 border">2 of 3 (wider)</div>
<div class="col p-2 border">3 of 3</div>
</div>
</div>
<div class="container text-center">
<div class="row bg-body-highlight mb-3">
<div class="col-sm-8 p-2 border">col-sm-8</div>
<div class="col-sm-4 p-2 border">col-sm-4</div>
</div>
<div class="row bg-body-highlight">
<div class="col-sm p-2 border">col-sm</div>
<div class="col-sm p-2 border">col-sm</div>
<div class="col-sm p-2 border">col-sm</div>
</div>
</div>
<div class="container text-center">
<div class="row mb-3">
<div class="col-md-8 bg-body-highlight p-2 border">.col-md-8</div>
<div class="col-6 col-md-4 bg-body-highlight p-2 border">.col-6 .col-md-4</div>
</div>
<div class="row mb-3">
<div class="col-6 col-md-4 bg-body-highlight p-2 border">.col-6 .col-md-4</div>
<div class="col-6 col-md-4 bg-body-highlight p-2 border">.col-6 .col-md-4</div>
<div class="col-6 col-md-4 bg-body-highlight p-2 border">.col-6 .col-md-4</div>
</div>
<div class="row">
<div class="col-6 bg-body-highlight p-2 border">.col-6</div>
<div class="col-6 bg-body-highlight p-2 border">.col-6</div>
</div>
</div>
Row columns
Use the responsive .row-cols-*
classes to quickly set the number of columns that best render your content and layout. Whereas normal .col-*
classes apply to the individual columns (e.g., .col-md-4
), the row columns classes are set on the parent .row as a shortcut. With .row-cols-auto
you can give the columns their natural width.
Use these row columns classes to quickly create basic grid layouts or to control your card layouts.
<div class="container text-center">
<div class="row row-cols-2 bg-body-highlight">
<div class="col p-2 border">Column</div>
<div class="col p-2 border">Column</div>
<div class="col p-2 border">Column</div>
<div class="col p-2 border">Column</div>
</div>
</div>
<div class="container text-center">
<div class="row">
<div class="col-sm-3 bg-body-highlight p-2 border">Level 1: .col-sm-3</div>
<div class="col-sm-9 bg-body-highlight p-3 border">
<div class="row">
<div class="col-8 col-sm-6 p-2 border">Level 2: .col-8 .col-sm-6</div>
<div class="col-4 col-sm-6 p-2 border">Level 2: .col-4 .col-sm-6</div>
</div>
</div>
</div>
</div>