1 reply [Last post]
FreddyK's picture
Last seen: 3 years 2 weeks ago
Timezone: GMT+11
Joined: 2020-01-15
Posts: 1
Points: 2

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's picture
Last seen: 39 weeks 1 day ago
Timezone: GMT+2
Joined: 2019-11-22
Posts: 5
Points: 5

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()