用CSS实现下图样式:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<link rel="stylesheet" type="text/css" href="1.css">
<title>--</title>
</head>
<body>
<div id="demo">
</div>
</body>
</html>
1.css:
#demo {
width: 100px;
height: 100px;
background-color: #fff;
position: relative;
border: 2px solid #333;
}
#demo:after,#demo:before {
border:solid transparent;
content:' ';
height: 0;
left: 100%;
position: absolute;
width: 0;
}
#demo:after {
border-width: 10px;
border-left-color: #fff;
top: 20px;
}
#demo:before {
border-width: 12px;
border-left-color: #000;
top: 18px;
}
(摘自牛客网某问答题)