Alan Gresley wrote:

So I put the following rule in the stylesheet:
[bgcolor] {background-color: transparent}

and it worked!  All the HTML elements with bgcolor were reset!
[...]
I did a few test and found that you can use just simple type selectors
also. This CSS,

body { background: lime; }

will override this.

<body bgcolor="#FFFFCC">

Indeed, and it works more widely, since there are still essential limitations in support to attribute selectors. In particular, if the document triggers Quirks Mode, attribute selectors won't work on IE even in version 8.

Note that to override all bgcolor attributes set in HTML markup, you would set
* { background: lime; }
i.e. use the universal selector "*" instead of the element selector "body", since table cells may have bgcolor attributes too.

--
Yucca, http://www.cs.tut.fi/~jkorpela/
______________________________________________________________________
css-discuss [css-d@lists.css-discuss.org]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
List policies -- http://css-discuss.org/policies.html
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/

Reply via email to