My goal is for all cells in a table to have a background color except ones with the class 'transparent'. Here is some sample code (corresponding jsfiddle):
<style>
td { background-color: red }
td.transparent { background-color: none }
</style>
<table>
<tr>
<td>foo</td>
<td class="transparent">bar</td>
</tr>
</table>
Why doesn't the td.transparent cell follow the td.transparent css rule? When I inspect the element the rule is there, but it is getting overridden by the td rule, which seems to break normal css specificity rules.
I can get what I want by using rgba(0,0,0,0)
instead of none
, but rgba is not supported in IE8 and I would like to avoid using an ugly hack if I could.
I'd also like to simply understand why this isn't working the way I expected.
Thoughts?
none
is not a valid property value forbackground-color
. It is forbackground-image
, however, thus the shortcutbackground: none
will work. – Celestina