Discussion:
[css-grid] :nth-row, :nth-column selectors and similar
(too old to reply)
Jacob Pratt
2018-01-23 03:29:45 UTC
Permalink
All,

Are there any active proposals (or any that have been shot down) regarding
table-like selectors for CSS Grid? Namely the following:

- nth-row
- nth-column
- nth-last-row
- nth-last-column
- first-row
- first-column
- last-row
- last-column

These selectors could prove incredibly useful with `auto-fit`, and
especially once subgrid is implemented.

The use case would be similar to that of tables, but for cases where tables
are not necessarily appropriate to be used.

The one problem I can think of: how will elements that span multiple tracks
be handled? My naïve solution would be to use the top left cell, though
I've no clue on the benefits and drawbacks from such.

jhpratt
Jacob Pratt
2018-01-23 03:44:30 UTC
Permalink
I thought subgrid was still being promoted, though I haven't been following
it too closely.

Taking the track with the plurality would certainly make more sense. It may
not necessarily have >=50%, though.

jhpratt
Hello,
I don't think that there is currently. However, some notes: is subgrid
still being promoted? Since we have grids within grids by just css
definition.
Second, I would say that concerning the multiple rows and columns problem.
I would say it should be based off of covering 50% or more of the element.
Where that amount is configurable in the grid. This way it can be decided
by the designer.
Sebastian Malton
*Sent:* January 22, 2018 10:34 PM
*Subject:* [css-grid] :nth-row, :nth-column selectors and similar
All,
Are there any active proposals (or any that have been shot down) regarding
- nth-row
- nth-column
- nth-last-row
- nth-last-column
- first-row
- first-column
- last-row
- last-column
These selectors could prove incredibly useful with `auto-fit`, and
especially once subgrid is implemented.
The use case would be similar to that of tables, but for cases where
tables are not necessarily appropriate to be used.
The one problem I can think of: how will elements that span multiple
tracks be handled? My naïve solution would be to use the top left cell,
though I've no clue on the benefits and drawbacks from such.
jhpratt
Sebastian Zartner
2018-04-10 10:39:41 UTC
Permalink
Post by Jacob Pratt
I thought subgrid was still being promoted, though I haven't been following
it too closely.
Taking the track with the plurality would certainly make more sense. It may
not necessarily have >=50%, though.
jhpratt
Hello,
I don't think that there is currently. However, some notes: is subgrid
still being promoted? Since we have grids within grids by just css
definition.
Subgrids *are* still promoted, they were just deferred to level 2 of
the specfication. See https://drafts.csswg.org/css-grid-2/#subgrids.
Subgrids are special, because they have constraints in regard of the
parent grid.
Post by Jacob Pratt
Second, I would say that concerning the multiple rows and columns problem.
I would say it should be based off of covering 50% or more of the element.
Where that amount is configurable in the grid. This way it can be decided by
the designer.
Sebastian Malton
Sent: January 22, 2018 10:34 PM
Subject: [css-grid] :nth-row, :nth-column selectors and similar
All,
Are there any active proposals (or any that have been shot down) regarding
table-like selectors for CSS Grid?
Yes, see https://github.com/w3c/csswg-drafts/issues/1943.

Sebastian
Post by Jacob Pratt
- nth-row
- nth-column
- nth-last-row
- nth-last-column
- first-row
- first-column
- last-row
- last-column
These selectors could prove incredibly useful with `auto-fit`, and
especially once subgrid is implemented.
The use case would be similar to that of tables, but for cases where
tables are not necessarily appropriate to be used.
The one problem I can think of: how will elements that span multiple
tracks be handled? My naïve solution would be to use the top left cell,
though I've no clue on the benefits and drawbacks from such.
jhpratt
Loading...