<!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>
.box {
position: relative;
margin: 0 auto;
width: 200px;
height: 200px;
background-color: #ccc;
}
a {
/* 绝对定位的行内元素可以直接设置宽高 */
position: absolute;
bottom: 0;
left: 0;
width: 50px;
height: 50px;
line-height: 50px;
color: black;
background-color: rgb(142, 165, 142);
}
a,
a:hover {
text-decoration: none;
}
</style>
</head>
<body>
<div class="box">
<a href="#">超链接</a>
</div>
</body>
</html>
代码运行效果