<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>雪碧</title>
<style type="text/css">
.btn:link{
/将a转换为块元素/
display: block;
/设置宽高/
width: 42px;
height: 30px;
/设置背景图片/
background-image: url(./img/1.png);
/设置背景图片不重复/
background-repeat: no-repeat;
background-position: -10px -338px;
}
.btn:hover{
/当是hover状态时,希望图片可以向左移动/
background-position: -58px -338px;
}
.btn:active{
/当是active状态时,希望图片再向左移动/
background-position: -130px -338px;
}
</style>
</head>
<body>
<a href="#" class="btn"></a>
</body>
</html>
网友评论