<h1>Simple CSS Speech Bubbles</h1>
<h2>Normal</h2>
<div class="speech-bubble">
Short text!
</div>
<h2>Rounded</h2>
<div class="speech-bubble rounded">
Longer text about nothing at all!
</div>
<h2>Different color</h2>
<div class="speech-bubble blue">
Another short text
</div>
<h2>Large size</h2>
<div class="speech-bubble large">
This is a large one!
</div>
<h2>Everything combined</h2>
<div class="speech-bubble rounded large blue">
Everything at once!
</div>
body {
margin: 2em;
}
.speech-bubble {
background: #ddd;
color: #333;
display: inline-block;
font-size: 14px;
line-height: 4em;
margin-bottom: 1em;
padding: 0 1em;
position: relative;
text-align: center;
vertical-align: top;
min-width: 7em;
}
.speech-bubble:after {
border: 1em solid transparent;
border-top-color: #ddd;
content: '';
margin-left: -1em;
position: absolute;
top: 100%;
left: 50%;
width: 0;
height: 0;
}
.speech-bubble.large {
font-size: 2em;
padding: 0 1em;
min-width: 4em;
}
.speech-bubble.rounded {
border-radius: .4em;
}
.speech-bubble.blue {
background: #ddf;
color: #334;
}
.speech-bubble.blue:after {
border-top-color: #ddf;
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.