question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Mixing grid and container (vs nested usage) results in differing container width

See original GitHub issue

Bug 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

  1. 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:closed
  • Created 4 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
brendoncommented, Sep 11, 2019

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/

🤦‍♂

1reaction
brendoncommented, Sep 9, 2019

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:

.ui.ui.grid.container {}

to trump:

.ui.ui.ui.container:not(.fluid) {}
Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found