I am fairly new to CSS and I am trying to create a speech bubble using a span tag, but I want it positioned relative to the parent div container.
Is there a way to achieve this without it affecting the display of the pseudo element?
HTML (example):
<div id='divcontainer'>
<span> </span>
</div>
CSS
#divcontainer { position: relative; }
span {
/* The span tag should be placed 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;
}
Any tips or guidance on how to accomplish this would be greatly appreciated!