background 是CSS简写属性,用来集中设置各种背景属性。background 可以设置:background-color, background-image, background-position, background-repeat, background-size, background-attachment
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style>
.a,.b,.c,.d{
width: 200px;
height: 200px;
background-color:url(1.gif);
background-repeat: no-repeat;
}
.a{
background-position: 10px 10px;
}
.b{
background-position: 10px 20px;
}
.c{
background-position: 10px 30px;
}
.d{
background-position: 10px 40px;
}
</style>
</head>
<body>
<div class="a"></div>
<div class="b"></div>
<div class="c"></div>
<div class="d"></div>
</body>
</html>