【发布时间】:2020-07-01 02:36:48
【问题描述】:
这里是 CSS 新手。使用 span 标签的对话气泡应相对于父 divcontainer 定位。
如何在不影响伪元素显示的情况下做到这一点?
HTML(示例):
<div id='divcontainer'>
<span> </span>
</div>
CSS
#divcontainer { position: relative; }
span {
/* span tag shall be positioned relative to the div.*/
position: relative;
left: 18px;
top: -15px;
white-space: nowrap;
font-size: 12px;
background: white;
border: 1px solid white;
border-radius: 7px;
padding-bottom: 5px;
visibility: hidden;
}
span:after {
content: '';
position: absolute;
bottom: 0;
left: 45%;
width: 0;
height: 0;
border: 18px solid transparent;
border-top-color: white;
border-bottom: 0;
border-left: 0;
margin-bottom: -10px;
}
非常感谢任何建议!
【问题讨论】:
标签: html css positioning pseudo-element