Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/matlab/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Css 覆盖整个页面的背景图像_Css_Background Image - Fatal编程技术网

Css 覆盖整个页面的背景图像

Css 覆盖整个页面的背景图像,css,background-image,Css,Background Image,我有上面的图像 我必须将其设置为覆盖整个页面。我尝试了以下代码 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%;

我有上面的图像

我必须将其设置为覆盖整个页面。我尝试了以下代码

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;
但我得到的是这个。

它没有覆盖整个页面。底部是空白,有人能帮我吗?提前谢谢。

只需更改此项即可

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

background: url(../images/common/header/Background_color.png); background-repeat:repeat;
试试这个:

background-size: cover;

你能说清楚一点吗?事实上,我使用了背景重复。你想让我改变什么?我试过了。。。当我以这种方式尝试时,图像会重复,而不是底部的空白。但它没有被拉伸。当我使用背景重复:重复,而不是空白,显示图像顶部的深棕色。因此我希望您能想象它的外观。重复-x表示背景在顶部重复-y表示背景在底部重复表示全尺寸重复不起作用。但是得到了解决方案。感谢您的建议现在一切正常。我添加了以下内容:body,html{height:100%;padding:0;margin:0;}但它在IEI中不起作用,我得到了答案。我添加了这个:body,html{height:100%;padding:0;margin:0;}但是现在它在除IE之外的所有浏览器中都能工作。你知道如何在IE中工作吗?正如他们前面提到的,你应该添加这个:background repeat:repeat;