在寫主題樣式的時候經常會碰到用背景圖鋪滿整個背景的需求,這裏分享下使用方法
HTML代碼
<div id="lf_bg" style="background-image: url(images/bg.jpg);"></div>
CSS樣式
#lf_bg{
position:fixed;
top: 0;
left: 0;
width:100%;
height:100%;
min-width: 1000px;
z-index:-10;
zoom: 1;
background-attachment: fixed;
background-color: #fff;
background-repeat: no-repeat;
background-size: cover;
-webkit-background-size: cover;
-o-background-size: cover;
background-position: center 0;
}