<!DOCTYPE html>
<head>
<meta charset="UTF-8">
<title>css样式设置背景颜色</title>
<style type="text/css">
body{
background-color:transparent;
}
.one{
width:800px;
height:2000px;
/* background-color:aqua;
background-image:url(img/api.jpg);
background-repeat:no-repeat;
background-position:right top;
background-position:30px 10px;
background-attachment:fixed; */
background:aqua url(img/api.jpg) no-repeat right top fixed;
}
/* .two{
width:800px;
height:2000px;
background: green;
} */
</style>
</head>
<body>
<div class="one">
1sdfssjajdfaldfjoaldfladfls
www.w3school.com.cn/cssref/pr_background.asp
</div>
<!-- <div class="two">
1sdfssjajdfaldfjoaldfladfls
</div> -->
</body>
</html>
同时设置了right top 和 fixed 就是以浏览器为基准。