<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<style>
.nav a {
/* 修改格式 */
display: inline-block;
background-color: pink;
width: 120px;
height: 40px;
/* 文字居中 */
text-align: center;
line-height: 40px;
text-decoration: none;
color: black;
}
.nav .bg1 {
background: url(./D17-综合训练/images/div_1.png) no-repeat;
}
.nav .bg1:hover {
background: url(./D17-综合训练/images/div_2.png) no-repeat;
}
.nav .bg2 {
background: url(./D17-综合训练/images/div_1.png) no-repeat;
}
.nav .bg2:hover {
background: url(./D17-综合训练/images/div_2.png) no-repeat;
}
.nav .bg3 {
background: url(./D17-综合训练/images/div_1.png) no-repeat;
}
.nav .bg3:hover {
background: url(./D17-综合训练/images/div_2.png) no-repeat;
}
.nav .bg4 {
background: url(./D17-综合训练/images/div_1.png) no-repeat;
}
.nav .bg4:hover {
background: url(./D17-综合训练/images/div_2.png) no-repeat;
}
.nav .bg5 {
background: url(./D17-综合训练/images/div_1.png) no-repeat;
}
.nav .bg5:hover {
background: url(./D17-综合训练/images/div_2.png) no-repeat;
}
</style>
<body>
<div class="nav">
<a href="#" class="bg1">五彩导航栏</a>
<a href="#" class="bg2">五彩导航栏</a>
<a href="#" class="bg3">五彩导航栏</a>
<a href="#" class="bg4">五彩导航栏</a>
<a href="#" class="bg5">五彩导航栏</a>
</div>
</body>
</html>
用的图是自己找的图