I'm currently working on creating a semi-transparent speech bubble with a border. I'm using a ::before element for a larger triangle shape and a ::after element for a smaller triangle shape that sits on top to create the illusion of a border. However, the ::before element is causing issues as it is visible and affecting the transparency. Does anyone have a solution to this problem?
.bubble {
max-width: 75%;
min-width: 200px;
padding: 8px 12px 0 12px;
position: relative;
border-radius: 4px;
text-align: left;
margin-left: auto;
background-color: rgba(255, 0, 0, 0.3);
border: 1px solid black;
border-top-right-radius: 0;
margin-right: 16px;
}
.bubble::before, .bubble::after {
position: absolute;
width: 0;
height: 0;
top: 0;
content: '';
border-style: solid;
right: 0;
transform: translateX( 100% );
}
.bubble::before {
border-color: black transparent transparent transparent;
border-width: 18px 18px 0 0;
top: -1px;
}
.bubble::after {
border-color: rgba(255, 0, 0, 0.3) transparent transparent transparent;
border-width: 16px 16px 0 0;
}
<div class="bubble">
<p>
Hello
</p>
</div>