Mixing grid and container (vs nested usage) results in differing container width
See original GitHub issueBug Report
At a cursory glance, it appears there was a move away from negative margins on grid containers in a recent update. The result of this is that when mixing grid
and container
the resulting width of that container is different from what we’d get if we just nested a grid
inside a container
. This resulted in a visual change for me when upgrading from Semantic-UI to Fomantic-UI.
Steps to reproduce
- Create both of these:
<div class="ui three column grid container">
<div class="column"></div>
</div>
<div class="ui container">
<div class="ui three column grid">
<div class="column"></div>
</div>
</div>
Expected result
Both versions should have the same width.
Actual result
When viewed with Semantic UI v2.4.1 they will both have the same overall width. When viewed with Fomantic UI v2.7.8 the combined version will have a lesser width (2rem from what I can tell reading the CSS).
Version
2.7.8
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Relationship of grid layout to other layout methods - CSS
This is because when you wrap flex items, each new row (or column when working by column) is an independent flex line in...
Read more >CSS Grid Layout Module Level 2 - W3C
Grid containers can be nested or mixed with flex containers as necessary to create more complex layouts. 2.1. Declaring the Grid. The tracks...
Read more >Grid system - Bootstrap
Containers provide a means to center and horizontally pad your site's contents. Use .container for a responsive pixel width or .container-fluid for width:...
Read more >Bootstrap 5 grid system - examples and tutorial
Bootstrap's grid system uses a series of containers, rows, and columns to ... width: 100% across all viewports and devices, or a responsive...
Read more >CSS Grid - Guide
body { max-width: 320px; margin: 2% auto; } .container { display: grid; ... We can mix different measurement unit types for the grid...
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
Sorry, I missed even more detail in replicating. The column needs to be full-width to trigger it:
SUI: https://jsfiddle.net/4npfjxhL/ FUI: https://jsfiddle.net/neuf05s2/
🤦♂
Following this up, it appears related to this commit: https://github.com/fomantic/Fomantic-UI/commit/e3a6bc33005fdd9e4ba3c92863a051e94fb1417e#diff-19a0f29cbd9dd7f8b8b6490361863667R91
Specifically, the specificity of the rest of those selectors in that block needs to match the first (so they should all start with
.ui.ui.ui
to retain the expected original behaviour. In my case I need:to trump: