【发布时间】:2018-05-12 17:26:25
【问题描述】:
我想像这样显示聊天气泡。我使用 div 使用 CSS 类和 :after 和 clip-path 显示气泡。
风格:
.right-bubble {
margin-top: 12px;
padding: 5px 8px;
font-size: 13px;
position: relative;
background: #1e87f0;
border-radius: 5px;
text-align: right;
color:white;
box-shadow: 0 5px 15px rgba(0,0,0,.08);
z-index: 1;
}
.right-bubble:after {
width: 10px;
height: 45px;
bottom: 0;
background: #1e87f0;
right: -4px;
clip-path: polygon(0 70%, 0% 100%, 100% 100%);
}
HTML:
<div class="right-bubble">
<p>Welcome, adfdf adsfsdf adsfsdffa adsfdfadsf asdfsdf Please
wait. Our agent will join you shortly.asdfadsf adfd asdff asdf
fasdfdsf
</p>
</div>
它只显示圆角框。它不显示右下箭头。
【问题讨论】:
-
要出现伪元素,您需要添加
content:"";。 -
添加内容:"";不起作用。