background image to cover the entire page

做~自己de王妃 提交于 2019-12-13 06:05:20

问题


I have the above image

I have to set it in such a way that it covers the entire page. I tried the following code.

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;

But what I get is this.

It is not covering the entire page. At the bottom I am getting the white space.Could anyone help me? Thanks in advance.


回答1:


Just change this

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

To this

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



回答2:


try this :

background-size: cover;


来源:https://stackoverflow.com/questions/16476780/background-image-to-cover-the-entire-page

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!