2012-10-25 32 views
1

我的網站有一個由兩個圖像組成的背景。身體的背景圖像不會重複到視口

html{ 
height:100%; 
margin:0; 
padding:0; 
background-image:url('../images/backgroundbottom.png'); 
background-repeat:repeat-x; 
background-position:bottom; 
} 
body{ 
height:100%; 
margin:0; 
padding:0; 
font-family: "arial", "times", "courier"; 
font-size: 10pt; 
color:white; 
background-image:url('../images/backgroundtop.png'); 
background-repeat:repeat-x; 
} 

身體背景不適應像我的網站的動態環境,如html。身體背景停止在右側重複,但html延伸到整個視點。我已經在Chrome,FireFox,Android和Safari中測試過了。

html和body元素不會填充視口。此問題最有可能是由div引起的,該問題正在向position:absolute推向右側。

我該如何解決此問題?

+1

您能否給我們提供更多的HTML代碼 - 或者是頁面的鏈接,更清楚地展示問題? – Andy

+2

http://jsfiddle.net是你在這些情況下的朋友......它可以讓你複製你的問題,然後我們可以確切地看到你的意思(並可能爲你修復它) – freefaller

回答

1

嘗試添加background-attachment:fixed;

background-repeat:x; 
background-attachment:fixed; 
background-position:bottom; 
+0

這沒有幫助: ( – Lahey