问题
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