我已经为嵌套在面板中的按钮添加了 CSS 样式。但是,即使我将 !important 标签放在 css 中,按钮也不会显示为透明。
我也尝试过将 addStyles/cls: 标签添加到按钮对象,但这也没有用。
有人知道为什么会这样吗?
按钮代码:
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 类:
.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;
}
最佳答案
按钮的背景是通过在 td
中使用 background-image
设置的。这应该有效(here is demo):
JS:
var button = new Ext.Button({
text: month,
cls: "test",
// ...
});
CSS:
.test td {
background-position: 1000px 1000px;
}
关于javascript - CSS 样式不适用于 ExtJS 按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7240511/