无法更改鼠标悬停按钮的颜色 [英] Unable to change the color of a button on mouse over
本文介绍了无法更改鼠标悬停按钮的颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用母版页。在下面的代码中,我试图更改面板内按钮控件的颜色。
它不起作用。如何使它工作。
< asp:UpdatePanel ID = dd runat = server < span class =code-attribute> UpdateMode = 条件 >
< ContentTemplate >
< asp:按钮 ID = Button5 runat = server 文字 =' 草药 - 内部' 类 = stylebutton 字体大小 = 小 BackColor = ControlLightLight CausesValidation = false OnClick = btnherbal_click ForeColor = #666666 样式 = cursor:pointer; FONT-FAMILY:宋体;字体重量:正常;边距:28px;保证金左:0像素; BorderStyle = 无 / >
< / ContentTemplate >
< / asp:UpdatePanel >
。 stylebutton:hover
{
color : white;
background-color : 红色;
}
解决方案
设置如下样式
< asp:button id = Button5 runat = server text = 草药内部 class = stylebutton causevalidation = false onclick = btnherbal_click xmlns:asp = < span class =code-keyword>#unknown / >
你的css:
。 stylebutton {
cursor : 指针;
font-family : Verdana;
font-weight : 正常;
margin-top : 28px;
margin-left : 0px;
border-style : none;
color : #666666;
background-color : white;
}
。 stylebutton :hover {
cursor : 指针;
font-family : Verdana;
font-weight : 正常;
margin-top : 28px;
margin-left : 0px;
border-style : none;
color : white;
background-color : 红色;
}
>
对我来说它正在工作。请看下面的演示。
现场演示:的jsfiddle
I use a master page. In the following code I am trying to change the color of a button control which is inside a panel.
It is not working. How to make it work.
<asp:UpdatePanel ID="dd" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:Button ID="Button5" runat="server" Text='Herbal-Internal' Class="stylebutton" Font-Size="Small" BackColor="ControlLightLight" CausesValidation="false" OnClick="btnherbal_click" ForeColor="#666666" Style=" cursor:pointer; font-family:Verdana; font-weight:normal; margin-top:28px; margin-left:0px; " BorderStyle="None" />
</ContentTemplate>
</asp:UpdatePanel>
.stylebutton:hover
{
color: white;
background-color :Red;
}
解决方案
set styles as below
<asp:button id="Button5" runat="server" text="Herbal-Internal" class="stylebutton" causesvalidation="false" onclick="btnherbal_click" xmlns:asp="#unknown" />
your css:
.stylebutton { cursor: pointer; font-family: Verdana; font-weight: normal; margin-top: 28px; margin-left: 0px; border-style: none; color: #666666; background-color: white; } .stylebutton:hover { cursor: pointer; font-family: Verdana; font-weight: normal; margin-top: 28px; margin-left: 0px; border-style: none; color: white; background-color: Red; }
For me it's working.Please see the below demo.
LIVE DEMO: JSFiddle
这篇关于无法更改鼠标悬停按钮的颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文