Android/ phonegap - Stretching my background image to fit screen

一个人想着一个人 提交于 2019-12-12 18:28:34

问题


I have tried various differnt things however none of them seem to work. I am using inline CSS and simply want to add a background which stetches to the screen size. I am currently using the following code within my body tag:

<body onLoad="onBodyLoad();" style="background:url(images/blue_bg.png);">

My image is 400 x 300, but need to be streched to as far as 1200 x 1000.

Hope someone can help (have tried background-size:100%).

Thanks,


回答1:


You can try this CSS3 code:

body{
    background: url(images/blue-bg.png) no-repeat center center fixed;
    -webkit-background-size: cover;
    -moz-background-size: cover;
    -o-background-size: cover;
    background-size: cover;
}

If this doesn't work you can try :

Other CSS techniques

jQuery techniques



来源:https://stackoverflow.com/questions/9381264/android-phonegap-stretching-my-background-image-to-fit-screen

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!