Style a button in EXTJS

18,739
items: [
                 {
                     xtype: 'button',
                     align: 'right',
                     text:'Assign',
                     cls : 'foo' 
                 }
             ]

And in a CSS file:

.foo { background:black; }

This adds a CSS class to the outer most element of the Button. There may be many elements involved in the DOM markup, so use Firebug to figure out which elements you want to style. More details in Ext docs: http://docs.sencha.com/ext-js/4-0/#!/api/Ext.button.Button-cfg-cls

Share:
18,739
Sharon Watinsan
Author by

Sharon Watinsan

Updated on June 15, 2022

Comments

  • Sharon Watinsan
    Sharon Watinsan almost 2 years

    I have a button. and i need to align it to the right, make the font size increase and bold etc. When i googled it says i should use CSS.

    How can i use CSS, to style the button that i added ?

    My Question :

    Where should i add the CSS file in my application, and how can i use it to style the button ?

    items: [
                     {
                         xtype: 'button',
                         align: 'right',
                         text:'Assign' 
                     }
                 ]
    
  • Sharon Watinsan
    Sharon Watinsan almost 12 years
    Where should i add this CSS in the VIEW folder ?
  • Mats Bryntse
    Mats Bryntse almost 12 years
    Does not matter, put it in any folder.