在ExtJS中更改按钮文本颜色

时间:2022-04-05 09:39:40

I need to change text color of my button. I defined a css class like;

我需要更改按钮的文字颜色。我定义了一个css类;

.mbutton{
    background:transparent;
    color:red;
    border:none;
}

and button definition is here;

和按钮定义在这里;

Ext.create('Ext.Button', {
            renderTo: Ext.getBody(),
            text: 'Red text',
            cls:'mbutton'
   });

fiddle: https://fiddle.sencha.com/#fiddle/olj

小提琴:https://fiddle.sencha.com/#fiddle/olj

1 个解决方案

#1


1  

A button is generated with span elements inside. The color need to be changed in span instead in button. Do this way:

生成一个带有span元素的按钮。颜色需要在跨度而不是按钮中更改。这样做:

.mbutton span{
    color:red;
}

#1


1  

A button is generated with span elements inside. The color need to be changed in span instead in button. Do this way:

生成一个带有span元素的按钮。颜色需要在跨度而不是按钮中更改。这样做:

.mbutton span{
    color:red;
}