Android的/ PhoneGap的 - 拉伸我的背景图片以适应屏幕 [英] Android/ phonegap - Stretching my background image to fit screen
问题描述
我曾尝试过各种不同的事情但是他们都不工作。我使用内联CSS和只是想添加哪些stetches屏幕大小的背景。我目前使用我的身体标记内以下code:
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);">
我的形象是400×300,但需要来扩展到尽可能1200×1000。
My image is 400 x 300, but need to be streched to as far as 1200 x 1000.
希望有人能帮助(试过背景尺寸:100%)。
Hope someone can help (have tried background-size:100%).
谢谢,
推荐答案
您可以试试这个CSS3 code:
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 :
<一个href=\"http://buildinternet.com/2009/07/quick-tip-resizing-images-based-on-browser-window-size/\">jQuery技术
这篇关于Android的/ PhoneGap的 - 拉伸我的背景图片以适应屏幕的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!