欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

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>

                   css生成三角

相关标签: css