CSS 中的禁用按钮?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1068568/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Disabled Buttons in CSS?
提问by rahul
I'm trying to get a button which looks exactly the same whether it is enabled or disabled, but whenever I disable the button it seems to ignore any font styles I have set. This seems to be the case in IE but not other browsers.
我试图获得一个无论启用还是禁用都看起来完全相同的按钮,但是每当我禁用该按钮时,它似乎都会忽略我设置的任何字体样式。在 IE 中似乎是这种情况,但在其他浏览器中则不然。
So does anybody know the CSS to change a disabled button so that the font is not embossed?
那么有没有人知道 CSS 更改禁用按钮以便字体不浮雕?
Thanks in advance, Chris
提前致谢,克里斯
[Edit] The CSS is as follows:
[编辑] CSS 如下:
.Button { background-color:#332F27; border-bottom-color:#1B1B1B; border-top-color:#3B3B3B; border-left-color:#3B3B3B; border-right-color:#0C0C0C; color:Black; font-style:normal; }
The button has the attribute Class="Button" [/Edit]
该按钮具有属性 Class="Button" [/Edit]
回答by rahul
If you are changing the disabled property of the button then you won't be able to get the feel and look of a normal button with CSS which will work in all browsers.
如果您正在更改按钮的 disabled 属性,那么您将无法获得可在所有浏览器中使用的带有 CSS 的普通按钮的感觉和外观。
The easiest way is to add another button with no click event attached to itand set this button's display to inline and hide the original one.
最简单的方法是添加另一个没有附加点击事件的按钮,并将此按钮的显示设置为内联并隐藏原始按钮。
If you still want to use CSS for this you can refer this link.
如果您仍然想为此使用 CSS,您可以参考此链接。
回答by Nikhil D
//You use this css it helps u
font-weight: bold;
border-right: #3C8FD1 1px solid;
border-top: #3C8FD1 1px solid;
border-left: #3C8FD1 1px solid;
border-bottom: #3C8FD1 1px solid;
font-size: 10px;
color: #045FA7;
font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
background-image: url(../App_Images/cssbuttonbg.gif);
line-height: 14px;