<!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>
<style>
a {
text-decoration: none;
color: black;
display: inline-block;/* 将行内元素转换为行内块元素*/
width: 120px;
height: 58px;
background-color: blue;
text-align: center;
line-height: 50px;
}
.one {
background-image: url(./bg1.png);
}
.two {
background-image: url(./bg2.png);
}
.three {
background-image: url(./bg3.png);
}
.four {
background-image: url(./bg4.png);
}
.one:hover {
background-image: url(./bg5.png);
}
.two:hover {
background-image: url(./bg6.png);
background-repeat: no-repeat;
}
.three:hover {
background-image: url(./bg7.png);
}
.four:hover {
background-image: url(./bg8.png);
}
a:hover {
width: 120px;
height: 120px;
background-color: pink;
}/*这一小节有问题
</style>
</head>
<body>
<a href="#" class="one">五彩云南</a>
<a href="#" class="two">五彩云南</a>
<a href="#" class="three">五彩云南</a>
<a href="#" class="four">五彩云南</a>
<div></div>
</body>
</html>
运行
作业问题:只要第二个可以显示粉色小框,且不为正方形