How to use two different styles for links
Moderator: General Moderators
How to use two different styles for links
Is it possible? I've got one style setup in my linked stylesheet. However, I'd like to use a different style for certain links on my page while leaving the default style for the other links. Can different classes be setup for links? I've searched far and wide for a definitive answer, but haven't found one yet.
always the most specialized selector of a css statement is used.
i.e. the body
a{ color: #ff0000; } .specialAnchor{ color: #00ff00; }
a class-id is more specific than a simple tag-selector --> the first link will be red, the second green
a:hover { color: #ff0000; } a.specialAnchor:hover{ color: #00ff00; }
the same goes for pseudo-classes
i.e. the body
Code: Select all
<a href="somewhere">click me</a>
<a class="specialAnchor" href="somewhere">click me, too</a>a class-id is more specific than a simple tag-selector --> the first link will be red, the second green
a:hover { color: #ff0000; } a.specialAnchor:hover{ color: #00ff00; }
the same goes for pseudo-classes