qqqqqqqqqqq
qqqqqqqqqqq

Reputation:

How to apply this CSS class to a given LinkButton?

a:link
{ 
    color: white; 
    background-color: black;
    text-decoration: none;
    border: 2px solid white; 
}

a:visited
{ 
    color: white; 
    background-color: black;
    text-decoration: none;
    border: 2px solid white; 
}

a:hover
{
    color: black; 
    background-color: white;
    text-decoration: none;
    border: 2px solid black; 
} 

Button :

<asp:LinkButton ID="A" runat="server" Text="A"
    OnClick="searchalpha" cssClass="a" />

It's not working -- do you have any solution for this?

Upvotes: 0

Views: 14024

Answers (3)

Himalaya Garg
Himalaya Garg

Reputation: 1609

a.mylink
{
    color: #990000;
    text-decoration:none;
}

a:hover.mylink
{
    color: #990000;
    text-decoration:underline;
}

You will find it useful...

Upvotes: 0

Guillaume Flandre
Guillaume Flandre

Reputation: 8980

i don't know asp so I don't know what HTML is render by such a LinkButton tag.

But here I see that you set the cssClass to "a". Which means that the associated CSS class is

.a{ /* your style */ }

Upvotes: 0

Vincent Ramdhanie
Vincent Ramdhanie

Reputation: 103135

The name of a class in CSS must start with a . (dot).

So your CSS should be

a.myclass:link{

}

etc.

and in the asp:LinkButton you can set the cssClass attribute to myclass

 <asp:LinkButton ID="A" runat="server" Text="A" OnClick="searchalpha" cssClass="myclass"></asp:LinkButton>

Upvotes: 5

Related Questions