Row gutter classes also affect container gutters
See original GitHub issueOperation system: all Browser: all Reduced test case: https://codepen.io/martinbean/pen/gOweLmQ?editors=1000
If you have a container within a row, and that row has gutters removed (.row.g-0
), the gutters are also removed from containers anywhere within that row (as it uses the --bs-gutter-x
CSS variable, and the .g-0
class sets the value of that variable to zero).
I would expect containers to still retain its padding. Is this intended or not?
Example:
<div class="row g-0">
<div class="col-12">
<div class="container">
<p>Container (now with no gutters)</p>
</div>
</div>
</div>
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (7 by maintainers)
Top Results From Across the Web
Gutters · Bootstrap v5.0
Row columns gutters. Gutter classes can also be added to row columns. In the following example, we use responsive row columns and responsive...
Read more >How to set gaps (gutters) in a flex container? - Stack Overflow
There are multiple items in a row. · If some items have not enough space, they go to next line. · There is...
Read more >Layout grid | U.S. Web Design System (USWDS)
The grid system uses a series of containers, rows, and columns to lay out and align content. The following row and corresponding code...
Read more >Bootstrap 5 — Gutters and Utility Classes | by John Au-Yeung
In this article, we'll look at how to add gutters and utility classes with Bootstrap 5. Row Columns Gutters. We can add the...
Read more >The Grid | Foundation for Sites 6 Docs
Collapse/Uncollapse Rows ... The .collapse class lets you remove column gutters (padding). There are times when you won't want each media query to...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Shouldn’t be the
$gutters
variable based on the$grid-gutter-width
rather than$spacers
? (https://github.com/twbs/bootstrap/blob/23fd488c380c347a3d0121a49b6285bdd65418a2/scss/_variables.scss#L470)Based on @martinbean’s comment we have gutters set to
1.5rem
by default so there is a mismatch in general with this.g-*
approach.@ffoodd Well, the container acts differently whether it’s inside a row or not. Some times it has gutters, some times it doesn’t.
My example is, I’m using a gutter-less row for an admin panel layout:
I have a fixed-width, left-hand column that holds a logo and navigation menu, and then a flexible right-hand column that holds the content. But because this row is the full width of the screen, I don’t want the content to just keep on expanding as well—I want it contained. So I wrapped it in a container.
The problem is on “medium”-sized screens (i.e. tablets) where the container has a max-width greater than the width of the right-hand column. The container is now butted up against the left-hand column and the right-hand side of the screen, instead of having spacing either side like I would expect, and like it would have in the previous four major versions of Bootstrap.