2012-07-17 53 views
5

我有一个简单的按钮,但我无法使图标居中。如何将图标放在extjs按钮中?

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

CSS:

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

此图片最高72x72像素。

回答

4

我想,你需要background-position

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

有没有理由你不使用标准的事情:

icon: '', 
iconAlign: 'center' 
+0

这只能说明图像的一部分。即使我使用规模:'大'。 – Beetlejuice 2012-07-18 11:31:01

+0

@sha:FYI有这个帖子... http://stackoverflow.com/review/suggested-edits/1748742 – Matt 2013-03-19 12:09:48

+0

iconAlign不具有值为“中心”发现了一个潜在的问题。 Ext JS 4.2.1。 – 2015-07-16 12:07:21

相关问题