aravind
aravind

Reputation: 1096

I want to change hyperlink color when I click on it

I have already used this.but it is not giving me any change

a.Grid:visited { 
    border:1px ridge black;
    color:Purple;
}

<asp:LinkButton ID="lnkPage" runat="server" Text = '<%#Eval("Text") %>' CssClass="Grid"></asp:LinkButton>

Upvotes: 1

Views: 1450

Answers (2)

Sachin
Sachin

Reputation: 40970

There are two things that you may want to achieve. one is change the color when link is clicked and another one is that color should remains same to indicate that particular link is clicked.

For the first option you can use :active pseudo class

a.Grid:active
{ 
    border:1px ridge black;
    color:Purple;
}

And for the second option, you need to use little bit JS to apply the active class on the link

$('a.Grid').on('click',function(){
$(this).addClass("active");
});

You can define your active class as you want

.active
{
    color:red;
}

Js Fiddle Example

Upvotes: 1

geevee
geevee

Reputation: 5451

replace :visited with :active

it will change it's color as long as it's clicked.

Upvotes: 0

Related Questions