Nth instance of a has selector
I have a table with a class of
table
. I also have some table rows (tr) that have a header (th) that has a row span. I am trying to have alternating stripes on the tr’s that have a th child.
Here is the CSS:
Basically, I only want the counter on the rows that have a table header element.
Any suggestions?5 Replies
you were super close
tr:nth-child(even of :has(th[scope="row"]))
and it works
https://developer.mozilla.org/en-US/docs/Web/CSS/:nth-child#using_of_selector <-- here's more about it
the support is pretty scary (2023 for chrome and firefox, 2015 for safari)
Thank you for the assist. I’ll be reading up on the of selector now.
you're welcome