这是代码和CSS,我已经检查了几个链接并进行了相应操作,但我仍然遇到问题。请解释一下。
<asp:Button ID="Button1" runat="server" BackColor="#93C323"
Font-Names="Segoe UI Light" Font-Size="X-Large" ForeColor="White" Height="41px"
style="margin-left: 144px" Text="+ Add" Width="121px" />
.button:hover
{
background:#DBDBDB;
}
最佳答案
当您想通过悬停或动态更改样式时,请避免使样式内联。这是我刚刚测试过并且正在运行的示例:
<asp:Button ID="Button1" runat="server" CssClass="OneButton" Text="ok" />
<style type="text/css">
.OneButton
{
background-color:#93C323;
font-size:x-large;
color:White;
height:41px;
width:121px;
margin-left:144px;
}
.OneButton:hover
{
background-color:#DBDBDB;
}
</style>
还有它的实时版本:http://jsfiddle.net/gwSWy/
关于c# - asp.net 按钮悬停不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15736092/