CSS-显示方块-2022-12-23

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<style>
#box{
width: 300px;
height: 300px;
padding: 10px;
border: 2px solid red;
}
a{
width: 100px;
height: 100px;
text-decoration: none;
background-color: #f7c0ff;
line-height: 100px;
text-align: center;
color: white;
display: block;
}
a:hover{
background: deepskyblue;
}
.a2,.a4{
position: relative;
left: 200px;
top: -100px;
}
.a5{
position: relative;
left: 100px;
top: -300px;
}
</style>

</head>
<body>

<div id="box">
<a class="a1" href="#">链接1</a>
<a class="a2" href="#">链接2</a>
<a class="a3" href="#">链接3</a>
<a class="a4" href="#">链接4</a>
<a class="a5" href="#">链接5</a>
</div>

</body>
</html>
posted @ 2022-12-23 20:10  Rui2022  阅读(104)  评论(0编辑  收藏  举报