2013-08-23 165 views
0

我想要一個完整大小的背景圖像,在div中。 div是最後一個元素,所以我希望它填充到頁面的底部。到目前爲止,我已經有了這樣的代碼,它可以填充到兩側,但將高度更改爲100%會使其消失,而我似乎無法使其填充頁面。div中的全尺寸背景圖像?

.launch { 
    background: url('Images/launchBackground.jpg') no-repeat center center fixed; 
    -webkit-background-size: cover; 
    -moz-background-size: cover; 
    -o-background-size: cover; 
    background-size: cover; 
} 
+0

你可以發佈你的網頁的HTML? – teynon

+0

試試'background-size:contains;'也許? – Shivam

+0

您是否可以嘗試減小背景圖像大小並重復長軸?你是否將div的高度屬性降低到99%或其他值接近100%? – PatrickT

回答

0

沒有看到你的HTML,你有沒有嘗試過:

background-image: url('Images/launchBackground.jpg') 

,你也可以嘗試手動設置:

.launch { 
    top: 0px; 
    left: 0px; 
    min-height: 100%; 
    min-width: 100%; 
    position: fixed; 
} 
0

嘗試使用屬性背景大小與值100%100%

例子:

.launch { 
 
    background: url('Images/launchBackground.jpg') no-repeat center center fixed; 
 
    -webkit-background-size: 100% 100%; 
 
    -moz-background-size: 100% 100%; 
 
    -o-background-size: 100% 100%; 
 
    background-size: 100% 100%; 
 
}