Extjs 4 中的按钮文本颜色 [英] Button text color in Extjs 4
本文介绍了Extjs 4 中的按钮文本颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用 Exjts 4 并且我想更改按钮文本颜色.这是我的代码:
I'm using Exjts 4 and i want to change the button text color. Here is my code:
{
xtype: 'button',
text: 'My Button',
style:{
color: 'red'
}
}
推荐答案
Extjs 4.2.0,但可以覆盖.使用 cls:'yourClassName'
属性给你的 button
一个 class
,然后在 CSS 中创建一个到 span
的完整路径拿着文本,像这样:.yourClassName div a span
.还要给你的 css 属性一个 !important 值到成功覆盖基类.
There is some strange behavior in Extjs 4.2.0, but there is an override possible. Give your button
a class
using cls:'yourClassName'
property and then in CSS make a full path to span
holding the text, like so: .yourClassName div a span
. Also give your css property a !important value to successfuly override base class.
Ext.create('Ext.Button', {
text: 'Click me',
renderTo: Ext.getBody(),
handler: function() {
alert('You clicked the button!');
},
cls: 'foo'
});
在 css 中:
.foo div a span
{
color:#ff0000 !important;
}
这篇关于Extjs 4 中的按钮文本颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文