madchat1
asked on
Can I use DOM in CSS?
Can I use DOM in CSS? I want the set the bgColor of an element to the bgColor of the parent by using CSS – How can I?
ASKER
I tried transparent by it's no good coz in FireFox it doesn't work so well.
(And what does #parentDivId mean? Why do need the parent if it is transparent)
Thanks.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Actually, you can use JavaScript in your CSS files. However, it's only executed once, so it may not be just what you want (see http://www.quirksmode.org/css/javascript.html). An alternative is to manipulate the CSS in onPageLoad, where you can set the colors as you wish.
@bpmurray,
That is why I wrote it in this way: "No you cannot use DOM in --> crossbrowser CSS <--."
-r-
That is why I wrote it in this way: "No you cannot use DOM in --> crossbrowser CSS <--."
-r-
Yes, Roonan, the embedded JS in CSS only works in IE and Opera (and is regarded as a naughty thing to do). However, the idea of manipulating styles in an onload function is perfectly valid and works across browsers.
#parentDivId element {background:transparent;}
-r-