Henderikus Parekowhai
Henderikus Parekowhai

Reputation: 51

Is there a way that i can have a onclick in css?

Is there a :hover selector that can be used when an 'a' tag is clicked it causes it to change color and then turns back when the click is released?

Any help is much appreciated. :D

Upvotes: 0

Views: 45

Answers (2)

Atula
Atula

Reputation: 2173

try this one too

https://jsfiddle.net/kLju23fx/2/

<code>
a:hover {
    color: hotpink;
}
a:active {
    color: blue;
}
a:link {
    color: red;
}
a:visited {
    color: green;
}
</code>

Upvotes: 0

Wowsk
Wowsk

Reputation: 3675

Use :active selector, this is used to select the active element, in this case the a element.

a:active{
  color:purple;
}
<a>Click Me</a>

Upvotes: 3

Related Questions