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一个跨度
.同时为您的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屋!
查看全文