Creating a polyfill for additional pseudo-classes
A feature that has not yet (at the time of writing) left the issue state on the CSSWG Drafts GitHub repository of the W3C is additional selectors for auto-filled, implicit grids. The entire issue can be found here: https://github.com/w3c/csswg-drafts/issues/1943.
Understanding the idea behind nth-row and nth-col
The author of the original GitHub issue stated in 2017 that they’d like to see a :nth-row()
selector. It would target all elements in a given row or pattern, similar to :nth-child()
. Let’s also consider a pseudo-class called :nth-col()
. It would function the same way but target columns instead.
We could, for example, give differing background colors to all elements in every odd row, or target every fifth column to attach different borders.
Why and when the polyfill may be useful
This polyfill can be especially useful to implement galleries or table-like structures on dashboards, as it eases the styling...