I have this code. Right now, the background-color of the <td> is red. How can I make it green, i.e. remove the <td>'s background color (red) so that the <tr>'s background-color (green) shows through? “background-color: none” doesn’t work.
I also tried “background-color: transparent”, but then it’s white. I want it to be green, i.e. the <tr>'s color.
“background-color: inherit” doesn’t seem to work either.
a <tr> is defined with a green background
on top of it a <td> with a red background.
let’s think of it as two layers, like in photoshop: green layer on bottom, red layer on top.
can i just remove the red layer when it’s on top alredy?
–
Jeff: background-color:transparent doesn’t work. It’s somehow a fake transparent I get in IE:
in theory a <td> defined as transparent should show what’s underneath it (the green <tr>). However, it is completely transparent, i.e. the background of the page shows through.
A td doesn’t sit on top of a tr, it’s a cell within the row (tr), although for the purposes of background inheritence it can be considered that way.
Create a separate class for the ones that you wish to be green, alternatively set the table background to green and the cell to red. BTW - have you tried background: inherit; ?
hurricane.uk is correct. A <tr> doesn’t actually have dimension, so it doesn’t display anything itself. When you assign a background color to it, it’s child element <td> inherits that background color. Applying a background color to the <td> changes the color.