Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

select specific column in all rows from table header class name

Tags:

css

In a table all <th> are having class and <td> dont.

Is it possible to apply the styles from those <th> class to all its corresponding <td>'s with plain css and dont need of any script?

Additionally table is dynamic and so columns index may differ. So i cant use nth-child and only way i can navigate it with class.

Here is the Fiddle

Any better ideas for cross-browser?

Update:

table may have n number of columns and not limited to 2 columns

like image 846
Hary Avatar asked May 15 '26 22:05

Hary


1 Answers

You could handle this using <col>, http://www.quirksmode.org/css/columns.html#background, only other way I see would need to add the classes everywhere or to use JS.

like image 172
Simon Avatar answered May 18 '26 16:05

Simon



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!