css 仿京东三角形案例

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style type="text/css">
div {
position: relative;
200px;
height: 100px;
background-color: pink;
margin:100px;
}

p {
position: absolute;
top: -20px;
left: 50%;
margin-left: -10px;
0;
height: 0;
border-style: solid;
border- 10px;
border-color: transparent transparent pink transparent;
font-size: 0;
line-height: 0;
}
</style>
</head>
<body>
<div>
<p></p>
</div>
</body>
</html>

原文地址:https://www.cnblogs.com/ericblog1992/p/12915974.html