I can’t find a simple css solution to target only tr from table ignoring all child (td and th) to use background-image:linear-gradient().
this solution :
table-name tr:nth-child(even)
add background to all td and th.
I want just target each row (tr) depending even or odd for me it would be direct childs from table.
I try
table-name:nth-child(odd or even)
or
table-name > *:nth-child(odd or even)
they don’t work
Is javascript the only solution?
it’s really strange that the W3C hasn’t thought of this
2
Answers
I found a solution:
I put the problem and the solution below in the code snippet Thanks for your answer.
How safari render table tr with linear background :
Here’s a table with the
tr
elements set to have a linear gradient background. Is this what you mean?