Speech Bubble

CSS only Speech Bubble

by ian_smithz

HTML

<div class="bubble">
  Your text here. This bubble will auto adjust based on the content specified here.
</div>
<br/>
<br/>
<div class="bubble">
  200 Likes
</div>

CSS

.bubble {
  text-align: center;
  font-family: arial;
  font-size: 13px;
  position: relative;
  display: inline-block;
  max-width: 250px;
  padding: 10px;
  color: white;
  background-color: #4CAF50;
  border: #388E3C solid 1px;
  -webkit-border-radius: 15px;
  -moz-border-radius: 15px;
  border-radius: 15px;
}

.bubble:after {
  content: "";
  position: absolute;
  bottom: -8px;
  left: calc(50% - 8px);
  border-style: solid;
  border-width: 8px 8px 0;
  border-color: #4CAF50 transparent;
  display: block;
  z-index: 1;
}

.bubble:before {
  content: "";
  position: absolute;
  bottom: -9px;
  left: calc(50% - 9px);
  border-style: solid;
  border-width: 9px 9px 0;
  border-color: #388E3C transparent;
  display: block;
  width: 0;
  z-index: 0;
}