Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to center an icon in a extjs button?

Tags:

html

css

extjs

I have a simple button, but I can't make the icon to be centered on it.

{
    xtype: 'button',
    width: 150,
    height: 150,
    cls: 'startbutton'
}

css:

.startbutton { 
    background-image: url(Camera.png) !important;
}

This image is 72x72 pixels.

like image 982
Beetlejuice Avatar asked Jul 17 '12 13:07

Beetlejuice


Video Answer


2 Answers

I think,you need background-position:

.startbutton { 
    background-position: center center;
    background-image: url(Camera.png) !important;
}
like image 185
Engineer Avatar answered Sep 28 '22 04:09

Engineer


Is there reason you're not using standard things:

icon: '',
iconAlign: 'center'
like image 42
sha Avatar answered Sep 28 '22 05:09

sha