Gutters
Gutters are the gaps between your columns, used to responsively space and align content in the Modus Bootstrap grid system.
How they work
-
Gutters use native CSS
gapon the row. Numbered column widths and offsets account for the horizontal gap. Columns do not add gutter padding, and rows do not use negative margins. Add padding to an inner wrapper when your content needs it. -
Gutters start at
1.5rem(24px) wide. This allows us to match our grid to the margin and padding utilities scale. -
Gutters can be responsively adjusted. Use breakpoint-specific gutter classes to modify horizontal gutters, vertical gutters, and all gutters.
Horizontal gutters
Use .gx-* to control horizontal gaps. The row stays inside its parent, so you do not need extra container padding or an overflow wrapper to contain the gutters:
<div class="row gx-5">
<div class="col">
<div class="p-3">Custom column padding</div>
</div>
<div class="col">
<div class="p-3">Custom column padding</div>
</div>
</div>
Vertical gutters
Use .gy-* to control the gap between wrapped lines. Vertical gaps appear only between lines, without adding space before the first line or after the last:
<div class="row gy-5">
<div class="col-6">
<div class="p-3">Custom column padding</div>
</div>
<div class="col-6">
<div class="p-3">Custom column padding</div>
</div>
<div class="col-6">
<div class="p-3">Custom column padding</div>
</div>
<div class="col-6">
<div class="p-3">Custom column padding</div>
</div>
</div>
Horizontal & vertical gutters
Use .g-* classes to control horizontal and vertical gaps together.
<div class="row g-2">
<div class="col-6">
<div class="p-3">Custom column padding</div>
</div>
<div class="col-6">
<div class="p-3">Custom column padding</div>
</div>
<div class="col-6">
<div class="p-3">Custom column padding</div>
</div>
<div class="col-6">
<div class="p-3">Custom column padding</div>
</div>
</div>
Row columns gutters
Gutter classes can also be added to row columns. In the following example, we use responsive row columns and responsive gutter classes.
<div class="row row-cols-2 lg:row-cols-5 g-2 lg:g-3">
<div class="col">
<div class="p-3">Row column</div>
</div>
<div class="col">
<div class="p-3">Row column</div>
</div>
<div class="col">
<div class="p-3">Row column</div>
</div>
<div class="col">
<div class="p-3">Row column</div>
</div>
<div class="col">
<div class="p-3">Row column</div>
</div>
<div class="col">
<div class="p-3">Row column</div>
</div>
<div class="col">
<div class="p-3">Row column</div>
</div>
<div class="col">
<div class="p-3">Row column</div>
</div>
<div class="col">
<div class="p-3">Row column</div>
</div>
<div class="col">
<div class="p-3">Row column</div>
</div>
</div>
No gutters
Use .g-0 to remove horizontal and vertical gaps. Column widths and offsets update to match the zero gap.
Need an edge-to-edge design? Drop the parent .container or .container-fluid. Rows no longer need .mx-0 to prevent gutter overflow.
In practice, here’s how it looks. Note that you can continue to use this with all other predefined grid classes (including column widths, responsive tiers, reorders, and more).
<div class="row g-0">
<div class="sm:col-6 md:col-8">.sm:col-6 .md:col-8</div>
<div class="col-6 md:col-4">.col-6 .md:col-4</div>
</div>
Column widths and offsets
For a span of s columns in an N-column grid, the width is (row width + horizontal gap) × s / N − horizontal gap. An offset of s columns uses (row width + horizontal gap) × s / N. These calculations support mixed numbered spans without needing to count the items on each line.
.col shares the remaining space after gaps, while .col-auto keeps its content width. Numbered column classes outside a .row keep their percentage widths.
Use .g-*, .gx-*, and .gy-* to change flex grid gaps. Generic .gap-* utilities change gap without updating the gutter variables used by the width calculations. For custom CSS, set --bs-gutter-x and --bs-gutter-y on the row; include a length unit such as 0px for a zero horizontal gap.
Change the gutters
Classes are built from the $gutters Sass map which is inherited from the $spacers Sass map.
Gutter classes use values from the Sass map. A runtime override of --bs-spacer-* does not change those classes. To change gaps at runtime, set --bs-gutter-x and --bs-gutter-y on the row.
$grid-gutter-x: 1.5rem;
$gutters: $spacers;