Re: [csswg-drafts] [css-grid] `<pre>` blocks are breaking grid layout

I believe that this example behaves as specified. But it's the specified behavior of the `fr` units that is really a bit counter-intuitive (I ran into a similar issue myself, though with the `table` element, recently). It turns out that the grid tracks sized with `fr` [has the implied minimum with](https://drafts.csswg.org/css-grid/#algo-find-fr-size) of `auto`:

> If the product of the hypothetical fr size and a flexible track’s flex factor is less than the track’s base size, restart this algorithm treating all such tracks as inflexible.

So if a `fr`-sized track has some wide non-wrappable content (wide image, table or `pre` block with long lines), it can't get narrower than this content. The workaround for this is replacing `1fr` with something like `minmax(0%, 1fr)` ([see the forked Codepen](https://codepen.io/SelenIT/pen/awQxVo?editors=1100)).

-- 
GitHub Notification of comment by SelenIT
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/1589#issuecomment-314356243 using your GitHub account

Received on Tuesday, 11 July 2017 07:14:34 UTC