3

I have a button :

<div class="HeaderBarThreshold">
     <asp:LinkButton ID="SetThreshold" OnClick="btnSetThreshold_Click" runat="server">Threshold</asp:LinkButton>
</div>

I am trying to change the color of the button on mouse hover :

Here is my css :

.HeaderBarThreshold
{
    padding-left: 10px;
    font-weight: bold;
}
.HeaderBarThreshold:hover
{
    color: Red;      
}

It doesnt work somehow. Please let me know.

4

6 回答 6

3

Try using the CssClass Property of ASP.NET controls. This will directly point the LinkButton itself to the CSS class, instead of having to use the div tag. For example:

<asp:LinkButton ID="SetThreshold" OnClick="btnSetThreshold_Click" runat="server" CssClass="HeaderBarThreshold">Threshold</asp:LinkButton>
于 2013-09-06T20:23:45.700 回答
1

Add the CSS class attribute to your web control

<asp:LinkButton CSSClass="HeaderBarThreshold" ID="SetThreshold" OnClick="btnSetThreshold_Click" runat="server">Threshold</asp:LinkButton>

Also your CSS is wrong anyway because you don't have anything assigned to class "HeaderBarThreshold".

于 2013-09-06T19:23:51.740 回答
1

Here is a fiddle http://jsfiddle.net/zpfw7/

    .HeaderBarThreshold
    {
    padding-left: 10px;
    font-weight: bold;
    width:300px;
    height:30px;
    border:1px solid #000;
    text-align:center;
    }
    .HeaderBarThreshold:hover
    {
    color: Red; 
    background:blue;
    }
于 2013-09-06T19:24:53.087 回答
1

try this thing:

.HeaderBarThreshold a:hover
{
    color: Red;      
}
于 2013-09-06T19:25:37.267 回答
0

just try this

.HeaderBarThreshold:hover a
{
     color: Red !important; // !important may not be necessary 
}
于 2013-09-06T19:25:19.560 回答
0
.upda_link {
    font-size: 15px !important;
    color: white;
    font-weight: bolder;
}

.upda_link:hover {
    text-decoration: none;
    color: white;
}

<asp:LinkButton ID="LinkButton1" runat="server" Text="Update" CssClass="upda_link" CausesValidation="false">
</asp:LinkButton>
于 2017-07-14T07:07:32.580 回答