Vecta
Vecta

Reputation: 2350

CSS Link Problems

I'm having a bit of difficulty adding some CSS to a link. I'm using a CMS that automatically generates menus in an unordered list. However, where you're on a given page, it applies class="active" the the li and not to the link itself. This works fine for adding a background to the link, but I'm trying to change the link color.

<li class="active">
<a href="#">Link</a>
</li>

I'm having difficulty coming up with the CSS to say "If a link is in an li with class="active" then make the link text color x."

How might I accomplish this?

Thanks!

Upvotes: 0

Views: 108

Answers (4)

Badr Hari
Badr Hari

Reputation: 8424

Try this:

.active a {color: red;}

Upvotes: -1

joni
joni

Reputation: 5482

li.active a {color:whatever}

Upvotes: 1

Pekka
Pekka

Reputation: 449823

the path is

li.active a { color: .... }

The MDC CSS Reference has good examples for the various types of selectors.

Upvotes: 3

Dustin Laine
Dustin Laine

Reputation: 38553

a
{
    color: black;
}
a.active
{
    color: green;
}

Upvotes: 0

Related Questions