<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>实现雪碧图效果</title>
<style>
.container {
width: 300px;
height: 300px;
}
.pos{
width: 320px;
height: 100px;
}
.pos1{
background-image: url("./images/sprite.jpg");
background-position: -11px, -8px;
}
.pos2{
background-image: url("./images/sprite.jpg");
background-position: -341px, -8px;
}
.pos3{
background-image: url("./images/sprite.jpg");
background-position: -671px, -8px;
}
</style>
</head>
<body>
<div class="container">
<div class="pos pos1"></div>
<div class="pos pos2"></div>
<div class="pos pos3"></div>
</div>
</body>
</html>
相关推荐
© 2020 asciim码
人生就是一场修行