Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Can I use DOM in CSS?

Posted on 2006-07-04
9
Medium Priority
?
221 Views
Last Modified: 2013-11-19
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?
0
Comment
Question by:madchat1
  • 3
  • 2
9 Comments
 
LVL 49

Expert Comment

by:Roonaan
ID: 17040304
You can set the element to be transparent:
#parentDivId element {background:transparent;}

-r-
0
 

Author Comment

by:madchat1
ID: 17040325

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.
0
 
LVL 49

Accepted Solution

by:
Roonaan earned 500 total points
ID: 17040348
The official answer to your question would be: No you cannot use DOM in crossbrowser CSS.

-r-
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 15

Expert Comment

by:bpmurray
ID: 17041558
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.
0
 
LVL 49

Expert Comment

by:Roonaan
ID: 17041634
@bpmurray,

That is why I wrote it in this way: "No you cannot use DOM in --> crossbrowser CSS <--."

-r-
0
 
LVL 15

Expert Comment

by:bpmurray
ID: 17041785
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.
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Color can increase conversions, create feelings of warmth or even incite people to get behind a cause. If you want your website to really impact site visitors, then it is vital to consider the impact color has on them.
Although a lot of people devote their energy toward marketing for specific industries, there are some basic principles that can be applied to any sector imaginable. We’ll look at four steps to take and examine how those steps were put into action fo…
This video teaches users how to migrate an existing Wordpress website to a new domain.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Suggested Courses

916 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question