css生成三角
程序员文章站
2022-03-10 20:00:32
...
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>css生成三角</title>
<style>
body {
background: #efefef;
}
.box {
width: 200px;
height: 200px;
position: relative;
margin: 100px auto 0;
box-shadow: 0 0 8px rgba(0, 0, 0, .2);
background-color: #fff;
border-radius: 4px;
}
/*生成伪元素*/
.box::before {
position: absolute;
width: 10px;
height: 10px;
content: "";
top: -5px;
left: 27px;
transform: rotate(45deg);
background-color: #fff;
box-shadow: 0 0 8px rgba(0,0,0,.2);
z-index: -1;
}
.box::after {
position: absolute;
content: "";
left: 20px;
bottom: 99%;
width: 0;
height: 0;
border: 12px solid transparent;
border-bottom-color: #fff;
}
</style>
</head>
<body>
<div class="box"></div>
</body>
</html>
上一篇: 详解Python中的变量及其命名和打印
下一篇: 下载windows 聚焦锁屏的图片