JSFiddle - React, Tailwind, and code Playground

HTML

<link rel="stylesheet" href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css">

  <i data-count="5" class="fa fa-shopping-cart fa-2x cartbadge"></i>

CSS

i {
  width: 100px;
  text-align: center;
  vertical-align: middle;
  position: static;
  color: #296199;
}

.cartbadge::after {
  content: attr(data-count);
  position: relative;
  background: rgba(64, 64, 64, 1);
  height: 2rem;
  top: -1.25rem;
  right: 0.5rem;
  width: 2rem;
  padding: 0.25rem 0.5rem;
  text-align: center;
  line-height: 2rem;
  font-size: 0.75rem;
  border-radius: 50%;
  color: white;
  border: 1px solid #404040;
}

.cartbadge[data-count="0"]::after {
  display: none;
}