背景图片覆盖整个页面

时间:2013-05-10 06:55:02

标签: css css3 background-image

我有上面的图片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

它不会覆盖整个页面。在底部,我正在获得白色空间。有人可以帮助我吗?提前谢谢。

2 个答案:

答案 0 :(得分:0)

只需更改此

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

到此

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

答案 1 :(得分:0)

试试这个:

background-size: cover;
相关问题