效果图:
代码:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>模仿京东的二维码突出的箭头位置</title>
<style>
*{
margin:0;
padding:0;
}
.hezi{
position: relative;
width:200px;
height: 200px;
background-color: pink;
border:1px solid pink;
margin:20px auto;
}
.hezi p:nth-of-type(1){
position: absolute;
top:-40px;
left: 50%;
margin-left: -20px;
width:0;
height: 0;
line-height:0;
border-style: solid;
border-width: 20px;
font-size: 0;
border-color: transparent transparent pink transparent;
}
</style>
</head>
<body>
<div class="hezi">
<p></p>
</div>
</body>
</html>