我试图改变一个按钮的风格与一个嵌入的图像,如下图所示:
http://jsfiddle.net/krishnathota/xzBaZ/1/
在这个例子中,恐怕没有图像。
我试着:
当按钮被禁用时更改按钮的背景颜色
当按钮被禁用时,更改按钮中的图像
禁用悬停效果时禁用
当您在按钮中单击图像并拖动它时,可以单独看到图像;我想避免这种情况
可以选择按钮上的文本。我也想避免这种情况。
我试着做in button[disabled]。但有些效果是无法消除的。就像
上图:1 px;位置:相对;和图像。
在页面中添加以下代码。不改变按钮事件,禁用/启用按钮只需在JavaScript中添加/删除按钮类。
方法1
<asp Button ID="btnSave" CssClass="disabledContent" runat="server" />
<style type="text/css">
.disabledContent
{
cursor: not-allowed;
background-color: rgb(229, 229, 229) !important;
}
.disabledContent > *
{
pointer-events:none;
}
</style>
方法2
<asp Button ID="btnSubmit" CssClass="btn-disable" runat="server" />
<style type="text/css">
.btn-disable
{
cursor: not-allowed;
pointer-events: none;
/*Button disabled - CSS color class*/
color: #c0c0c0;
background-color: #ffffff;
}
</style>
为禁用按钮应用灰色按钮CSS。
button[disabled]:active, button[disabled],
input[type="button"][disabled]:active,
input[type="button"][disabled],
input[type="submit"][disabled]:active,
input[type="submit"][disabled] ,
button[disabled]:hover,
input[type="button"][disabled]:hover,
input[type="submit"][disabled]:hover
{
border: 2px outset ButtonFace;
color: GrayText;
cursor: inherit;
background-color: #ddd;
background: #ddd;
}