2013-10-06 84 views
1

我想用一些文字将图片居中放在下面。当我用铬显示时,工作正常。它也适用于使用Opera Mobile的模拟器。但是当我用html/css文件创建我的phonegap应用程序时,图像在Android中运行时拒绝居中。css居中在Phonegap中不起作用

这里是我的CSS:

.centered { 
    width: 100%; 
    height: auto; 
    position: fixed; 
    top: 20%; 
    text-align:center; 
} 

任何想法?

感谢

回答

1

难道这是与position: fixed;的问题吗?

尝试例如。

.centered { 
    width: 100%; 
    height: auto; 
    position: absolute; 
    top: 20%; 
    right: 0px; 
    bottom: 20%; 
    left: 0px; 
    margin: auto; 
    text-align: center; 
} 
0

试试这个:

.centered { 
width: 100%; 
height: auto; 
position: fixed; 
top: 20%; 
text-align:center; 
-webkit-backface-visibility: hidden; 
} 
0

我会建议你定义图像的宽度和使用

.centered{ 
margin:0 auto; 
}