示例代码如下
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
#web_bg {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-image: url(/bg.jpg);
z-index: -10;
zoom: 1;
background-color: #fff;
background-repeat: no-repeat;
background-size: cover;
-webkit-background-size: cover;
-o-background-size: cover;
background-position: center 0;
}
</style>
</head>
<body>
<div>
<!--背景图片-->
<div id="web_bg"></div>
<!--其他代码 ... -->
</div>
</body>
</html>