实现鼠标悬停图片变化效果:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>亚马逊</title>
<style type="text/css">
.a{
width: 42px;
margin: 0 auto;
}
.a1{
position: absolute;
width: 42px;
height: 30px;
background-image: url("./images/amazon-sprite_.png");
background-repeat: no-repeat;
background-position: -8px -338px;
}
.a1:hover{
background-position: -58px -338px
}
</style>
</head>
<body>
<div class="a">
<a href="#" class="a1"></a>
</div>
</body>
</html>
网友评论