skip to Main Content

How to color a table column with a specific class in its header using CSS?

table, th, td { padding: 10px; border: 1px solid black; border-collapse: collapse; } th.red { background-color: red; } <table> <thead> <tr> <th>q</th><th class="red">w</th><th>e</th><th>r</th><th>t</th><th>y</th> </tr> </thead> <tbody> <tr> <td>q1</td><td>w1</td><td>e1</td><td>r1</td><td>t1</td><td>y1</td> </tr> <tr> <td>q2</td><td>w2</td><td>e2</td><td>r2</td><td>t2</td><td>y2</td> </tr> </tbody> </table> Is there a way to color…

VIEW QUESTION
Back To Top
Search