2013-05-10 230 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