You are only setting the color for the hyperlink *inside* the div#right.
Since the div#cloud is not a descendant of the hyperlink inside div#right, the colors will not get inherited.
Main Topics
Browse All TopicsHello experts,
I have a web page and it is being styled by an external css stylesheet.
I have a div called <div id="right"></div>
and in the stylesheet i am setting all anchors like so.
div#right a, div#right a:link, div#right a:active, div#right a:visited
{
color: #5C640F; /* green */
}
I also have another div inside div#right called <div id="cloud"></div>
there is no anchor styles set for this div so it should be inheriting from its parent (div right)
The problem i am having is overriding anchor classes within the cloud div.
In my stylesheet I have global classes set like this.
.red
{
color: #a13b1b;
}
.lightred
{
color: #f2a561;
}
.orange
{
color: #EA7816;
}
.lightorange
{
color: #f4c14c;
}
and so in div cloud i'll have an anchor tag like so <a href="blah.html" class="red">link</a>
and the link above does not turn red! the class color does not override the color set on its parent div.
Can anyone help me with a solution to this?
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Business Accounts
Answer for Membership
by: flob9Posted on 2009-08-20 at 04:12:59ID: 25141020
You can use the child selector to prevent inheritance (see code attached)
Else, you have to define the color for each link states :
#cloud a.red,
#cloud a:link.red,
#cloud a:active.red,
#cloud a:visited.red
{
color: #a13b1b;
}
Select allOpen in new window