2013-05-10 231 views
0
整個頁面

我上面的圖片enter image description here背景圖像覆蓋

我必須將其設置爲覆蓋整個頁面的方式。我試了下面的代碼。

margin: 0px; 
    background: url(../images/common/header/Background_color.png); 
    background-repeat:repeat-x; 
    background-attachment:fixed; 
    background-position:top center; 
    height: 100%; 
    width: 100%; 
    border: 0; 
    display:inline-block; 
    background-color: transparent; 

但是我得到的是這個。 enter image description here

它沒有覆蓋整個頁面。在底部,我得到了白色空間。任何人都可以幫助我嗎?提前致謝。

回答

0

只要改變這個

background: url(../images/common/header/Background_color.png); background-repeat:repeat-x; 

對此

background: url(../images/common/header/Background_color.png); background-repeat:repeat; 
+0

可否請你有點更清晰?其實我用過background-repeat。你想讓我改變什麼? – mukund 2013-05-10 07:02:37

+0

我嘗試過......當我以這種方式嘗試時,而不是底部的空白區域,圖像被重複。但它不會被拉伸。當我使用background-repeat:重複,而不是空白時,顯示圖像頂部的深褐色。因此,我希望你能想象它的外觀。 – mukund 2013-05-10 07:16:01

+0

repeat-x意味着背景只是在頂部 repeat-y意味着底部的背景 重複的平均值完整尺寸 – 2013-05-10 07:28:15

0

試試這個:

background-size: cover; 
+0

我得到了答案。我加了這個:body,html { height:100%; 填充:0; margin:0; }但現在它可以在除IE以外的所有瀏覽器上工作。您是否有任何想法如何使它在IE – mukund 2013-05-10 09:21:29

+0

中工作,因爲他們之前提到您應該添加以下內容:background-repeat:repeat; – Pine 2013-05-10 15:50:53