css 仿京东三角形案例

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

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

posted @ 2020-05-19 11:35  EricBlog  阅读(223)  评论(0编辑  收藏  举报