2014-06-14 43 views
1

我有一個1920x1080的大背景圖片。我想在着陸頁上使用它作爲完整的背景圖像。我在我的個人電腦上使用了Chrome,Firefox,Opera,並且它運行良好,即使在我的iPad上也是如此。但不是在我的應用程序Chrome應用程序的Android手機中,圖像在那裏,但它沒有填寫整個頁面,它只是在屏幕中間(portait模式)結束。我想用這張圖片填寫整個頁面背景。css背景圖像在Android上顯示錯誤

body{ 
background-image: url(bg_2.jpg); 
background-size: cover; 
-webkit-background-size: cover; 
-moz-background-size: cover; 
-o-background-size: cover; 
background-position: center center; 
background-repeat: no-repeat; 
background-attachment: fixed;  
} 

回答

0

我用這對我的移動應用程序:

<meta name="viewport" 
content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no" /> 

和CSS:

body { 
    background: transparent url(../icons/texture.png) no-repeat center center; 
    background-size: cover; 
} 

最好

中號

+0

**「maximum-scale = 1,user-scalable = no」** - 某處小狗在哭。請不要使用此...它不被推薦,並提供**非常**糟糕的用戶體驗。 –

0

您可以使用:

body { 
    background-image: url(bg_2.jpg); 
    background-size: contain; 
    -webkit-background-size: contain; 
    -moz-background-size: contain; 
    -o-background-size: contain; 
    background-position: center center; 
    background-repeat: no-repeat; 
    background-attachment: fixed; 
} 

將「封面」更改爲「包含」。但在看到結果之後,我寧願要封面。