有时候需要给网页加背景图,于是在网上找了一段css代码,记录于此备用。
.all_bg{
position:fixed;
top: 0;
left: 0;
width:100%;
height:100%;
min-width: 780px;
z-index:-10;
zoom: 1;
background-color: #fff;
background: url(http://leow.cn/pic/all_bg.jpg);
background-repeat: no-repeat;
background-size: cover;
-webkit-background-size: cover;
-o-background-size: cover;
background-position: center 0;
}
再在<body>间引入以下内容
<div class="all_bg"></div>