Sandy.Arv
Sandy.Arv

Reputation: 605

Add color to a single line of a display field

I have this piece of code where I need to add color to a single line in a display field. how do i do that?

var text = Ext.create('Ext.form.field.Display', {
        fieldStyle: 'font-weight: bold; color:  #00a8d0',
        value : 'value  1' + '<br>' + 'value 2'
    });

By doing this, both value 1 and value 2 is colored. but i want just value 1 to be colred. Any suggestions would be appreciated. Thank you

Upvotes: 0

Views: 555

Answers (2)

Tejas
Tejas

Reputation: 902

Please refer this fiddle.Here please give some class name from css file and add these styling there.Reply if any issues.Any update

Upvotes: 1

Evan Trimboli
Evan Trimboli

Reputation: 30082

Just wrap the items in a div:

var text = Ext.create('Ext.form.field.Display', {
    renderTo: document.body,
    value: '<div style="font-weight: bold; color:  #00a8d0;">value 1</div><div>value 2</div>'
});

Upvotes: 4

Related Questions