1 reply [Last post]
FreddyK
FreddyK's picture
Offline
newbie
Last seen: 24 weeks 6 days ago
Timezone: GMT+11
Joined: 2020-01-15
Posts: 1
Points: 4

Hello, if I have send this before please forgive as I could not find this question in the forum. My question is this. For the table I placed onto the webpage the header styling seems to effect one of the columns as well. If I change the th styling background color the column also changes. All the other rows/columns are as I have set them. Now, I would not even know how to change the color of a single column. Can somebody help please?

Thanks heaps!

AlainPre
AlainPre's picture
Offline
newbie
OULLINS
Last seen: 12 weeks 22 hours ago
OULLINS
Timezone: GMT+2
Joined: 2019-11-22
Posts: 3
Points: 3

Changing the background of one column

This is how to change the background of the second column :

table td:nth-child(2) {background:red;}

Here's how to alternate two colors on the columns

table td:nth-child(even) {background:red;}
table td:nth-child(odd) {background:yellow;}

More exemples with :nth-child()