2017-09-04 181 views
-1

我的問題是關於CSS中的「背景圖像」。如何在全屏中添加「背景圖像」?我使用「寬度:100%」,但它不起作用。我想全屏顯示背景圖像

+0

'背景size'財產? – kukkuz

回答

1

html,body{ 
 
height: 100%; 
 
} 
 
body{ 
 
background-image:url(http://www.cutestpaw.com/wp-content/uploads/2016/02/s-Yoshi-The-Seal-Kitteh.jpg); 
 
background-position: center center; 
 
background-repeat: no-repeat; 
 
background-attachment: fixed; 
 
background-size: cover; 
 
}

0

 body { 
 
    background: url(http://i.imgur.com/aZO5Kolb.jpg) no-repeat center center fixed; 
 
    -webkit-background-size: cover; 
 
    -moz-background-size: cover; 
 
    -o-background-size: cover; 
 
    background-size: cover; 
 
    background-size: 100% 100%; 
 
} 
 
    html { 
 
     height: 100% 
 
    }