Praveen
Praveen

Reputation: 11

Add background color to label in Extjs

I want to add background color to label in EXTjs. Could anyone help? Thanks in advance.

Upvotes: 1

Views: 6831

Answers (2)

Oliver Watkins
Oliver Watkins

Reputation: 13489

Use the style config option :

{
    xtype: 'label',
    style: {
        background: 'red'
    }
}

labelStyle only works for using things like textfields

Upvotes: 1

Molecular Man
Molecular Man

Reputation: 22386

You can use field's labelStyle config:

{
    xtype: 'textfield',
    name: 'email',
    fieldLabel: 'Email Address',
    labelStyle: 'background-color: #f00;'
}

Here is demo

P.S. There is also labelCssExtra config which you can use. But I couldn't get it to work in ExtJS4.0.2a.

Upvotes: 1

Related Questions