Reputation: 157
I have the follownig code:
<ul class="menu">
<li class="leaf"><a href="#">First</a></li>
<li class="leaf"><a href="#">Second</a></li>
<li class="leaf"><a href="#">Third</a></li>
</ul>
and the css
.menu li:hover > a, .menu li.active > a{
color: white;
text-decoration: underline;
font-weight: bold;
}
When i hover the item the color change. But when i select the item, the css code doesn't work. I want when i select a link and go to other page, the link displayed in white. What's the selector? I thought it was li.active > a, but this doesn't work.
Upvotes: 0
Views: 43
Reputation: 93
If you want it to be white just while you are clicking the link, you should use li:active (.active would be a class). See http://www.w3schools.com/cssref/sel_active.asp
Upvotes: 3
Reputation: 323
As soon as you change the page everything is "forgotten". You would need javascript or jquery to do this.
Also you could use the :visited attribute but all links clicked once will be white then.
Hope it helps.
Upvotes: 1