纯CSS实现气泡框效果
目标效果
实现
<div class="pop triangle-border">Hello</div>
/* 气泡框类*/
.pop {
...
}
/* 气泡尖角伪元素*/
.triangle-border:before {
content: '';
position: absolute;
top: 10px; /* controls vertical position */
bottom: auto;
left: -8px;
border-width: 6px 8px 6px 0;
border-style: solid;
border-color: transparent @theme-color;
/* reduce the damage in FF3.0 */
display: block;
width: 0;
}
.triangle-border:after {
content: '';
position: absolute;
top: 10px;
bottom: auto;
left: -7px;
border-width: 6px 8px 6px 0;
border-style: solid;
border-color: transparent #f7f7f7;
/* reduce the damage in FF3.0 */
display: block;
width: 0;
}
参考
https://ruanyifeng.com/blog/2010/04/css_speech_bubbles.html
https://nicolasgallagher.com/pure-css-speech-bubbles/
https://nicolasgallagher.com/pure-css-speech-bubbles/demo/
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
2020-07-29 Windows Powershell 执行策略更改