无法将图像放入相同尺寸的sencha触控面板中

时间:2012-02-28 13:06:55

标签: background touch extjs

我使用300 x 400像素的sencha touch创建了一个面板。我有一个相同尺寸的图像,使用photoshop创建。我使用css作为面板的背景使用了图像:

#pnl {
  background: url(img/bg.png);
  no-repeat;
}

问题是图像太大而且只显示了大约一半。我添加了max-width: 100%但结果是一样的。

我做错了什么?有没有办法让任何尺寸的任何图像适合面板?

感谢。

1 个答案:

答案 0 :(得分:0)

试试这个:

JS:

App.somePanel= new Ext.Panel({
    cls: 'somePanel',
    html: '<h1>Welcome to my app!</h1>',
    //some other properties
});

CSS:

.somePanel {
       background-image: url(http://somesite.com/someimage.png);
       background-repeat: no-repeat;
       background-size: 100% 100%;
}
相关问题