本文将介绍如何在CSS中实现背景图铺满页面的效果。首先,在HTML中需要设置一个div元素来承载背景图,代码如下:<div class= bg-img ></
<div class="bg-img"></div>
.bg-img {<br>
background: url(background.jpg) no-repeat center center fixed; <br>
-webkit-background-size: cover;<br>
-moz-background-size: cover;<br>
-o-background-size: cover;<br>
background-size: cover;<br>
}
.bg-img {<br>
background: url(background.jpg) no-repeat center center fixed; <br>
-webkit-background-size: cover;<br>
-moz-background-size: cover;<br>
-o-background-size: cover;<br>
background-size: cover;<br>
background-position: center;<br>
}
粉丝
0
关注
0
收藏
0