diff options
| author | Mark Otto <[email protected]> | 2018-07-24 17:26:29 -0700 |
|---|---|---|
| committer | Mark Otto <[email protected]> | 2018-07-24 17:26:29 -0700 |
| commit | ba25e38b4ac454ea0ff3ff35ef9b6f9cf80b34af (patch) | |
| tree | 3f9a057ef736613443c7330e4b12184b4eac95a0 /site/docs | |
| parent | fb2de04374a068594c84c1ec6aba6b5b3726ed27 (diff) | |
| parent | b0b28c81e50bedff322b12c13707c97982b4d455 (diff) | |
| download | bootstrap-ba25e38b4ac454ea0ff3ff35ef9b6f9cf80b34af.tar.xz bootstrap-ba25e38b4ac454ea0ff3ff35ef9b6f9cf80b34af.zip | |
Merge branch 'garhbod-patch-1' into v4-dev
Diffstat (limited to 'site/docs')
| -rw-r--r-- | site/docs/4.1/layout/grid.md | 14 | ||||
| -rw-r--r-- | site/docs/4.1/utilities/spacing.md | 22 |
2 files changed, 36 insertions, 0 deletions
diff --git a/site/docs/4.1/layout/grid.md b/site/docs/4.1/layout/grid.md index e697517d7..1ee089381 100644 --- a/site/docs/4.1/layout/grid.md +++ b/site/docs/4.1/layout/grid.md @@ -324,6 +324,20 @@ Don't want your columns to simply stack in some grid tiers? Use a combination of {% include example.html content=example %} </div> +### Gutters + +Gutters can be responsively adjusted by breakpoint-specific padding and negative margin utility classes. To change the gutters in a given row, pair a negative margin utility on the `.row` and matching padding utilities on the `.col`s. + +Here's an example of customizing the Bootstrap grid at the large (`lg`) breakpoint and above. We've increased the `.col` padding with `.px-lg-5` and then counteracted that with `.mx-lg-n5` on the parent `.row`. + +{% capture example %} +<div class="row mx-lg-n5"> + <div class="col py-3 px-lg-5 border bg-light">Custom column padding</div> + <div class="col py-3 px-lg-5 border bg-light">Custom column padding</div> +</div> +{% endcapture %} +{% include example.html content=example %} + ## Alignment Use flexbox alignment utilities to vertically and horizontally align columns. diff --git a/site/docs/4.1/utilities/spacing.md b/site/docs/4.1/utilities/spacing.md index b374748e0..dad1c0085 100644 --- a/site/docs/4.1/utilities/spacing.md +++ b/site/docs/4.1/utilities/spacing.md @@ -81,3 +81,25 @@ Additionally, Bootstrap also includes an `.mx-auto` class for horizontally cente Centered element </div> {% endhighlight %} + +### Negative margin + +In CSS, `margin` properties can utilize negative values (`padding` cannot). As of 4.2, we've added negative margin utilities for every non-zero integer size listed above (e.g., `1`, `2`, `3`, `4`, `5`). These utilities are ideal for customizing grid column gutters across breakpoints. + +The syntax is nearly the same as the default, positive margin utilities, but with the addition of `n` before the requested size. Here's an example class that's the opposite of `.mt-1`: + +{% highlight scss %} +.mt-n1 { + margin-top: -0.25rem !important; +} +{% endhighlight %} + +Here's an example of customizing the Bootstrap grid at the medium (`md`) breakpoint and above. We've increased the `.col` padding with `.px-md-5` and then counteracted that with `.mx-md-n5` on the parent `.row`. + +{% capture example %} +<div class="row mx-md-n5"> + <div class="col py-3 px-md-5 border bg-light">Custom column padding</div> + <div class="col py-3 px-md-5 border bg-light">Custom column padding</div> +</div> +{% endcapture %} +{% include example.html content=example %} |
