2013-04-14 205 views
0

我需要一個背景遍佈我的頁面。我該如何解決這個問題。問題是通過不使用position: fixed如果我的內容增長,背景將不可見。位置固定背景高度100%

<body> 
    <div id="Bgr"></div> 
    ... 
</body> 

#Bgr 
{ 
    position: fixed; 
    height: 100%; 
    background: url('../images/content-background.png') repeat-y 0, 0; 
} 

更新:我已經在身體不同的背景和我的HTML,身體是100%高度

+0

本文由克里斯Coyier可以幫助你:http://css-tricks.com/perfect-full-page-background-image/我希望它有幫助! –

回答

1

保證人體CSS是窗口大小。常見的忽視。

添加

body { 
    width:100%; 
    height:100%; 
} 
0

我可以將兩個圖像轉換成身體,因爲IE10等,這解決了我的問題了。

0

我喜歡用absolute爲這種事情:

#Bgr 
{ 
    position: absolute; 
    background: url('../images/content-background.png') repeat-y 0, 0; 
    top: 0; 
    right: 0; 
    left: 0; 
    bottom: 0; 
}