I need to fix a site that has a default style set for TD:
#cmsContent table td {
background-color: #d7d7d9;
}
however the client, using the CMS editor wants to paste in some HTML they created in dreamweaver to set the background of some tds to a bunch of different colors, example:
<td bgcolor="#669900">
(this is a small chuck of a huge ugly piece of dreamweaver generated html they put in the CMS, lots of tds with lots of colors)
however the style set in the style sheet is making all the backgrounds grey.
I am wondering if there is a way I can 'undo' the default style set in #cmsContent table td and let the bgColor for the td show through. I am hoping I can wrap that table in a div with a class that will undo the #d7d7d9 background color and let the bgcolor show through.
<div class='overrideTDColor'><table>...<td bgcolor="#669900"> .... etc
and then in my style sheet
#cmsContent .overrideTDColor table td {
background-color: ?????
}
Is it possible to do something like that? Remember each TD in the clients table is a different color, so I can't just set the override one to some specific color.
Any ideas, other than rewrite the dreamweaver html for them to use style="" instead of bgcolor="" on the tds?
No, if there's a background-color style applying to a td then it will always take precedence over the bgcolor attribute, and you won't be able to use CSS to undo that style to make the browser use the HTML attribute. You'll need to either hardcode the same value in the HTML into a new CSS rule for each td element, or use JavaScript to read the stylesheet and delete the background-color rule.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With