2016-11-25 71 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%; 
    }