css伪元素使用
直接上代码
CSS
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<title>Document</title>
<style>
* {
padding: 0;
margin: 0;
}
.father {
width: 100px;
height: 100px;
background-color: blue;
}
.father::after {
position: absolute;
content: "";
top: 0;
left: 0;
width: 50px;
height: 50px;
background-color: skyblue;
}
</style>
</head>
<body>
<div class="father"></div>
</body>
</html>
来源:CSDN
作者:big tail
链接:https://blog.csdn.net/qq_37698249/article/details/103897371