Joie
Joie

Reputation: 141

Set link of class to different color (CSS/HTML)

so I have two sets of links in an HTML document. Most of them (any normal link showing up on the site) have been set to my desired color, but I want four of them to have a different color and hover color than the others.

I set <a class="other" href="/">different link</a> on those links in my HTML and

a.other { color:fff; }

a.other:hover { color: #8741ff; }

in my CSS, but the links of .other are still showing up like all the rest.

Is there a way to rectify this?

Thanks. :)

Upvotes: 0

Views: 61

Answers (2)

user2521387
user2521387

Reputation:

a.other:link,
a.other:visited {
   color: #ffffff;
}
a.other:hover,
a.other:focus {
    color: #ffcc00;
}

I think that should do it. You have to use the pseudo-attribute of the link element a.classname:link I guess. And yes, you omitted the hashtag.

Upvotes: 1

A. Vidor
A. Vidor

Reputation: 2550

You left out the hash sign (#) before fff. :)

Upvotes: 0

Related Questions