要求: 使用一个div
<!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>一个DIV之Tip</title>
</head>
<body>
<div class="tip-container show">
填充内容
</div>
<style>
.tip-container{
position: relative;
background-color: #fff;
box-shadow: #bbb 0px 2px 8px 1px;
border-radius: 6px;
width: max-content;
padding: 10px;
}
.tip-container::before{
content: '';
position: absolute;
bottom: -8px;
left: 12px;
height: 0px;
width: 0px;
border-top: 8px solid #fff;
border-right: 8px solid transparent;
border-left: 8px solid transparent;
border-bottom: 0px solid #bbb;
}
.tip-container::after{
content: '';
position: absolute;
bottom: -6px;
left: 14px;
height: 12px;
width: 12px;
box-shadow: #bbb 0px 2px 8px 2px;
transform: rotate(45deg);
-webkit-transform: rotate(45deg);
-moz-transform: rotate(45deg);
-ms-transform: rotate(45deg);
-o-transform: rotate(45deg);
z-index: -1;
}
</style>
</body>
</html>