Re: [csswg-drafts] Elements spanned by <col> are not easily selectable (#10510)

What you're looking for is in the spec but not yet in browsers: [Grid-Structural Selectors: Column combinator (||), :nth-col() pseudo-class,  :nth-last-col() pseudo-class](https://drafts.csswg.org/selectors-4/#table-pseudos).

The `:nth-col()` selectors should help with selecting table cells within a column regardless of spanning attributes.

The column-descendent combinator `||` would let you select table cells within a column that matches a selector on the col element (like `col.row-totals || td.group-totals` ).

Adding in `:has()` should simplify @aardrian's example to `col:has( || th[aria-sort])`.

Again: that doesn't yet work in browsers! But that's the proposal in the spec. Take a look & decide if it addresses your use cases or file issues suggesting changes. And please file browser bugs, with links to the spec, letting them know you really, really, really want to be able to use these features.

[Column combinator support (currently none) on CanIUse](https://caniuse.com/mdn-css_selectors_column) (I don't see a separate entry for the nth-col ones).



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


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Friday, 28 June 2024 22:48:15 UTC