我想全屏显示背景图像

时间:2017-09-04 18:04:07

标签: html css background width background-image

我的问题是关于CSS中的“背景图像”。如何在全屏幕中添加“背景图像”?我使用“宽度:100%”,但它不起作用。

2 个答案:

答案 0 :(得分: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;
}

答案 1 :(得分: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%
     }




相关问题