Spacing
$spacing-1 |
0.25rem | 4px | |
$spacing-2 |
0.5rem | 8px | |
$spacing-3 |
1em | 16px | |
$spacing-4 |
1.5rem | 24px | |
$spacing-5 |
2em | 32px | |
$spacing-6 |
3em | 48px |
Margin and padding
(You can add more sizes by adding entries to the $spacers Sass map variable.)
Examples
Here are some representative examples of these classes:
Padding
.p-0
.p-1
.p-2
.p-3
.p-4
.p-5
.p-6
Margin
.m-0
.m-1
.m-2
.m-3
.m-4
.m-5
.m-6
Horizontal centering
Centered element
Negative margin
Note: These negative margins are disabled by default, but can be enabled in Sass by setting $enable-negative-margins: true.
Gap
When using display: grid, you can make use of gap utilities on the parent grid container.
Grid item 1
Grid item 2
Grid item 3
Support includes responsive options for all of Bootstrap’s grid breakpoints, as well as six sizes from the $spacers map (0–5). There is no .gap-auto utility class as it’s effectively the same as .gap-0.