声明:以下内容为个人学习总结,可能有理解有误或记录错误之处,初衷是方便自己学习复习记录。
实现效果
点击前:
点击后:
实现代码
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
.nav {
text-align: center;
}
.nav a {
display: inline-block;
width: 200px;
height: 50px;
line-height: 50px;
text-decoration: none;
color: white;
/*background-color: pink;*/
background: url(imgs/h.png) no-repeat;
}
.nav a:hover {
background-image: url(imgs/l.png);
}
</style>
</head>
<body>
<div class="nav">
<a href="#">首页</a>
<a href="#">前端</a>
<a href="#">后端</a>
<a href="#">工具使用</a>
<a href="#">关于我</a>
</div>
</body>
</html>
背景图片:
链接:https://pan.baidu.com/s/1I5InT8UDWvix9LGiDtnuFA
提取码:j5q7
复制这段内容后打开百度网盘手机App,操作更方便哦