<div class="message person-1" data-text="Hello">Hello, how's it going?
</div>
<div class="message person-1" data-text="Are you there?">Are you there?</div>
<div class="message person-2" data-text="Oh, HELLO there!">Oh, HELLO there!</div>
<div class="message person-1" data-text="Welp, bye.">Welp, bye.</div>
.message {
width: 200px;
padding: 10px;
margin-bottom: 10px;
background: orange;
color: darkblue;
border-radius: 5px;
position: relative;
margin-left: auto;
margin-right: auto;
}
.message::after {
content: "";
display: block;
position: absolute;
left: -18px;
bottom: 1px;
width: 0;
height: 0;
border-style: solid;
border-width: 10px 20px 10px 0;
border-color: transparent orange transparent transparent;
}
.message.person-2 {
background: lightpink;
color: darkred;
}
.message.person-2::after {
left: auto;
right: -18px;
border-width: 10px 0 10px 20px;
border-color: transparent transparent transparent lightpink;
}
.message[data-text*="hello" i]::before {
content: "👋";
display: inline-block;
margin-right: 5px;
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.