2016-11-25 69 views
-1

我有一个背景图片,我想在我的网站上使用它,但问题是我不能让它完整的高度和宽度在任何尺寸,帮助我,请检查下面的代码全高/宽的背景图片

当前的代码,代码#1:柄,而不是完全

body { 
    background: url(http://localhost/wordpress/wp-content/uploads/2016/11/CHRISTINE-BACKGOURND.jpg) no-repeat center center fixed; 
    -webkit-background-size: cover; 
    -moz-background-size: cover; 
    -o-background-size: cover; 
    /* background-size: cover; */ 
    height: auto!important; 
    width: 100%!important; 
} 

代码#2

body { 
    background: url(http://localhost/wordpress/wp-content/uploads/2016/11/CHRISTINE-BACKGOURND.jpg) no-repeat center center fixed; 
    background-color: white; 
    background-size: auto 100%; 
    background-repeat: no-repeat; 
    background-position: left top; 
} 

我不能让它全宽度和高度:(请帮助

+1

高度:应给予100% –

+0

我有一种感觉,照片是有点儿NSFW。 – Prajwal

回答

3

html{ 
 
    width:100%,height:100%; 
 
    } 
 
body{ 
 
    background-image: url(https://i.stack.imgur.com/s0G3w.jpg); 
 
    height:100%; 
 
    width:100%; 
 
    }
<body> 
 
</body>

0

请试试这个

HTML

<body></body> 

CSS

html{ 
    width:100%,height:100%; 
    } 
body{ 
    background: url(../image.jpg) no-repeat; 
    background-size:cover; 
    height:100%; 
    width:100%; 
    }