css实现多角度对话框对话气泡语音气泡效果代码
代码语言:html
所属分类:布局界面
代码描述:css实现多角度对话框对话气泡语音气泡效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<style>
[speech-bubble], [speech-bubble] * { box-sizing: border-box }
[speech-bubble]{
--bbColor: grey;
--bbArrowSize: 1.5rem;
--bbBorderRadius: 0.25rem;
--bbPadding: 1rem;
background: var(--bbColor);
border-radius: var(--bbBorderRadius);
padding: var(--bbPadding);
position: relative;
}
[speech-bubble]::before{
content: '';
position: absolute;
background: var(--bbColor);
}
[speech-bubble][pbottom]{ margin-bottom: var(--bbArrowSize) }
[speech-bubble][ptop] { margin-top: var(--bbArrowSize); }
[speech-bubble][pleft] { margin-left: var(--bbArrowSize); }
[speech-bubble][pright] { margin-right: var(--bbArrowSize); }
/* bottom and top */
[speech-bubble][pbottom]::before,
[speech-bubble][ptop]::before{
--width: calc(var(--bbArrowSize) / 2 * 3);
height: var(--bbArrowSize);
width: var(--width);
}
/* bottom */
[speech-bubble][pbottom]::before{
top: calc(100% - 2px);
}
[speech-bubble][pbottom][aleft]::before{
left: 1rem;
clip-path: polygon(25% 0, 100% 0, 0% 100%)
}
[speech-bubble][pbottom][acenter]::befo.........完整代码请登录后点击上方下载按钮下载查看
















网友评论0