<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>聊天气泡</title>
<style>
.chat-bubble-left {
position: relative;
max-width: 150px;
background: #c31313;
border-radius: 5px;
padding: 5px;
color: #fff;
}
.chat-bubble-left:before {
content: "";
position: absolute;
top: 5px;
left: -12px;
/* 圆角的位置需要细心调试哦 */
width: 0;
height: 0;
/* border: solid 8px; */
border: 6px solid;
border-color: transparent #c31313 transparent transparent;
}
.chat-bubble-right {
position: relative;
max-width: 150px;
background: #1b43c4;
border-radius: 5px;
padding: 5px;
color: #fff;
}
.chat-bubble-right:before {
content: "";
position: absolute;
top: 5px;
right: -11px;
/* 圆角的位置需要细心调试哦 */
width: 0;
height: 0;
/* border: solid 8px; */
border: 6px solid;
border-color: transparent transparent transparent #1b43c4;
}
</style>
</head>
<body>
<div class="chat-bubble-left">这是聊天左气泡反对反对反对反对法</div>
<div class="chat-bubble-right" style="margin-top: 20px;">这是聊天右气泡</div>
</body>
</html>
标签:chat,color,width,聊天,5px,border,transparent,css,气泡
From: https://www.cnblogs.com/tn666/p/17675722.html