Layout
Gutters
The padding between columns, set per row on the theme's nine-step 4px spacing scale.
How they work
- Gutters are the gaps between column content, created by horizontal
padding. Each column getspadding-rightandpadding-left; the row gets a matching negative margin so the outer edges line up with the container. - Gutters start at 1.5rem. That is the width in a
.rowwith no gutter class, as--bs-gutter-x. On this theme's scale it equals.g-5. - Gutter classes follow the 0–8 spacing scale, not Bootstrap's 0–5.
.g-4is 1rem,.g-8is 4rem. Vertical gutters are set with.gy-*, horizontal with.gx-*, both with.g-*. - Gutter classes are responsive.
.gx-md-7changes only frommdup.
| Class | Value | Pixels at 16px root | Token |
|---|---|---|---|
.g-0, .gx-0, .gy-0 | 0 | 0 | --space-0 |
.g-1 | .25rem | 4px | --space-1 |
.g-2 | .5rem | 8px | --space-2 |
.g-3 | .75rem | 12px | --space-3 |
.g-4 | 1rem | 16px | --space-4 |
.g-5 | 1.5rem | 24px (the default) | --space-5 |
.g-6 | 2rem | 32px | --space-6 |
.g-7 | 3rem | 48px | --space-7 |
.g-8 | 4rem | 64px | --space-8 |
.g-5 there is 3rem; here it is 1.5rem. Use .g-7 for
3rem. The same shift applies to every margin and padding utility.Horizontal gutters
.gx-* classes control the horizontal gutter widths. The .container or
.container-fluid parent may need to be adjusted if larger gutters are used, to avoid
unwanted overflow — here with the matching padding utility, .px-7.
HTML
<div class="container px-7 text-center">
<div class="row gx-7">
<div class="col"><div class="border bg-body-tertiary p-3">Custom column padding</div></div>
<div class="col"><div class="border bg-body-tertiary p-3">Custom column padding</div></div>
</div>
</div>
An alternative is to add a wrapper around the .row with the
.overflow-hidden class:
HTML
<div class="container overflow-hidden text-center">
<div class="row gx-7">
<div class="col"><div class="border bg-body-tertiary p-3">Custom column padding</div></div>
<div class="col"><div class="border bg-body-tertiary p-3">Custom column padding</div></div>
</div>
</div>Vertical gutters
.gy-* classes control the vertical gutter widths within a row when columns wrap to new lines.
Like the horizontal gutters, the vertical gutters can cause some overflow below the .row at
the end of a page. If this occurs, add a wrapper with .overflow-hidden.
HTML
<div class="container overflow-hidden text-center">
<div class="row gy-8">
<div class="col-6"><div class="border bg-body-tertiary p-3">Custom column padding</div></div>
<div class="col-6"><div class="border bg-body-tertiary p-3">Custom column padding</div></div>
<div class="col-6"><div class="border bg-body-tertiary p-3">Custom column padding</div></div>
<div class="col-6"><div class="border bg-body-tertiary p-3">Custom column padding</div></div>
</div>
</div>Horizontal and vertical gutters
.g-* classes control both at once. In the example below we use a smaller gutter width, so
there is no need for the .overflow-hidden wrapper.
HTML
<div class="container text-center">
<div class="row g-2">
<div class="col-6"><div class="border bg-body-tertiary p-3">Custom column padding</div></div>
<div class="col-6"><div class="border bg-body-tertiary p-3">Custom column padding</div></div>
<div class="col-6"><div class="border bg-body-tertiary p-3">Custom column padding</div></div>
<div class="col-6"><div class="border bg-body-tertiary p-3">Custom column padding</div></div>
</div>
</div>And the far end of the scale, .g-6 (2rem), with a responsive override to .g-md-8:
HTML
<div class="container overflow-hidden text-center">
<div class="row g-6 g-md-8">
<div class="col-6"><div class="border bg-body-tertiary p-3">.g-6 .g-md-8</div></div>
<div class="col-6"><div class="border bg-body-tertiary p-3">.g-6 .g-md-8</div></div>
<div class="col-6"><div class="border bg-body-tertiary p-3">.g-6 .g-md-8</div></div>
<div class="col-6"><div class="border bg-body-tertiary p-3">.g-6 .g-md-8</div></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.
HTML
<div class="container text-center">
<div class="row row-cols-2 row-cols-lg-5 g-2 g-lg-4">
<div class="col"><div class="border bg-body-tertiary p-3">Row column</div></div>
<div class="col"><div class="border bg-body-tertiary p-3">Row column</div></div>
<div class="col"><div class="border bg-body-tertiary p-3">Row column</div></div>
<div class="col"><div class="border bg-body-tertiary p-3">Row column</div></div>
<div class="col"><div class="border bg-body-tertiary p-3">Row column</div></div>
<div class="col"><div class="border bg-body-tertiary p-3">Row column</div></div>
<div class="col"><div class="border bg-body-tertiary p-3">Row column</div></div>
<div class="col"><div class="border bg-body-tertiary p-3">Row column</div></div>
<div class="col"><div class="border bg-body-tertiary p-3">Row column</div></div>
<div class="col"><div class="border bg-body-tertiary p-3">Row column</div></div>
</div>
</div>No gutters
The gutters between columns in our predefined grid classes can be removed with .g-0. This
removes the negative margins from .row and the horizontal padding from all immediate children
columns. Bracket boards and tournament tables look best this way.
Need an edge-to-edge design? Drop the parent .container or
.container-fluid and add .mx-0 to the .row to prevent overflow.
In practice, here is how it looks. Note you can continue to use this with all other predefined grid classes (including column widths, responsive tiers, reorders and more).
HTML
<div class="row g-0 text-center">
<div class="col-sm-6 col-md-8"><div class="border bg-body-tertiary p-3">.col-sm-6 .col-md-8</div></div>
<div class="col-6 col-md-4"><div class="border bg-body-tertiary p-3">.col-6 .col-md-4</div></div>
</div>Change the gutters
Classes are built from the $gutters Sass map, which in this theme inherits from
$spacers — the nine-step token scale from scss/_variables.scss.
$spacers: (
0: 0,
1: .25rem,
2: .5rem,
3: .75rem,
4: 1rem,
5: 1.5rem,
6: 2rem,
7: 3rem,
8: 4rem,
);
$gutters: $spacers;
The default gutter (what a bare .row uses) is a separate variable,
$grid-gutter-width, left at 1.5rem. Change it to shift every row that has no
.g-* class. At runtime the same value is the --bs-gutter-x and
--bs-gutter-y custom properties on .row, so you can also override one row in
plain CSS.
.row.tight {
--bs-gutter-x: var(--space-2); /* .5rem, from the token layer */
}