Asp Button悬停和CSS

4 css asp.net

我有一个asp按钮控件,我已经应用了一些风格.我希望在悬停此按钮时,按钮的颜色应该改变或类似的东西.但我不明白为什么在CSS中按钮悬停功能不起作用!! 请帮忙.另外,请告诉我们按钮悬停的最佳效果是什么.

    <asp:Button ID="btnSearch" runat="server" CssClass="button"  OnClick="btnSearch_Click"     Style="width: 480px;" Text="Search" />

.button
{
    background: white;
    border: solid 1px grey;
    font-family: Arial, sans-serif;
    font-size: 12px;
    font-weight: bold;
    color: #001563;    
    height: 25px;  

}

.button:hover
{
    background: white;
    border: solid 1px grey;
    font-family: Arial, sans-serif;
    font-size: 12px;
    font-weight: bold;
    color: Red;   
    height: 25px;

}
Run Code Online (Sandbox Code Playgroud)

Him*_*dri 7

请检查以下代码:

 <asp:Button ID="btnSearch" runat="server" OnClick="btnSearch_Click"  Style="width: 480px;" CssClass="button" Text="Search" />
      <style type="text/css">
.button
{
    background: white;
    border: solid 1px grey;
    font-family: Arial, sans-serif;
    font-size: 12px;
    font-weight: bold;
    color: #001563;    
    height: 25px;  

}

.button:hover
{
    background: white;
    border: solid 1px grey;
    font-family: Arial, sans-serif;
    font-size: 12px;
    font-weight: bold;
    color: Red;   
    height: 25px;

}</style>
Run Code Online (Sandbox Code Playgroud)