javascript CSS 样式不适用于 ExtJS 按钮
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7240511/
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
CSS Styles not applying to ExtJS Button
提问by pm13
I have added css styles to my buttons which are nested within a panel. However, the buttons are not appearing as transparent even if I put the !important tag in the css.
我已经向嵌套在面板中的按钮添加了 css 样式。但是,即使我将 !important 标签放在 css 中,按钮也不会显示为透明。
I have also tried adding addStyles/cls: tags to the button object but that hasn't worked either.
我还尝试将 addStyles/cls: 标签添加到按钮对象,但这也不起作用。
Does anyone know why this might be?
有谁知道为什么会这样?
Button Code:
按钮代码:
var button = new Ext.Button({
text: month,
//cls: "test",
handler: function(button){
var buttonMonth = button.text;
getGrids(buttonMonth);
}
});
//button.addClass("test");
panel.add(button);
CSS Class:
CSS类:
.x-btn{
font:normal 11px tahoma, verdana, helvetica;
cursor:pointer;
white-space: nowrap;
}
.x-btn button {
border:0 none;
background:transparent !important;
font:normal 11px tahoma,verdana,helvetica;
padding-left:3px;
padding-right:3px;
cursor:pointer;
margin:0;
overflow:visible;
width:auto;
-moz-outline:0 none;
}
回答by Molecular Man
Buttons's backgound is set by using background-image
in td
s. This should work (here is demo):
JS:
按钮的背景是通过使用background-image
in td
s设置的。这应该工作(这里是演示):
JS:
var button = new Ext.Button({
text: month,
cls: "test",
// ...
});
CSS:
CSS:
.test td {
background-position: 1000px 1000px;
}