RE: [css-grid] Allow referencing the last line of implicit grids

> > If you want the amount of columns to equate the amount of tabs, you’re
> > relying on automatic placement, right? Then you cannot possibly have
> > two rows because the items would be allowed to locate on the second
> row.
> >
> > Well, I guess your answer to this is that they would do but can’t
> > because the second row is already filled with the item you placed
> > there using “1 / -1i” (where -1i means the last implicit line).
> > However, you’re forcing a relayout each time a new item is placed
> > because by increasing the amount of columns, it changes the placement
> > of positioned grid items and therefore require a new pass of the
> > positioned-items layout, which will update the “busy-cells matrix”.
> > Optimizations may be made but could be hard to implement.
> 
> Not really, no.  Especially if we limited it to only specifying the
> *last* implicit line (rather than letting you offset arbitrarily from that), then
> it's easy - the presence of such a grid item implicitly fills the entire rest of the
> row/column.  
> 
> Without such a restriction it would indeed be unstable, but we
> could perhaps still reserve the entire row/column even if you don't use it.

Indeed, that would work, but that may not look very intuitive to most developers.


> > What’s preventing you, in this case, to use a two-rows grid whose
> > first row is a <nav> element containing the tabs (which could be a
> > flex-box). Using a flexbox may allow line-wrapping once dividing into
> > columns cannot possibly work given the content min-size and is therefore
> much better.
> 
> Flexbox doesn't allow for alignment and other 2d things. You can often fake
> simple grids with a multiline flexbox, but it's not a general replacement.

In this case, this is exactly what you want, though. Tabs do not form a grid row, but a flex row that may wrap if there are more tabs than a single row may accommodate. More so, nothing must align relatively to the tabs, so the grid columns that are created are not useful at all in this case.

That being said I agree your rightish sidebar with footer example is already much more convincing, but I think in the end, it will be better to use subgrids to implement it (or, while we wait, use a nested grid for the content).

Received on Monday, 13 July 2015 21:13:12 UTC