Encase the fa-envelope
icon and the number inside a div
, with the wrapper div having a position:relative
and the number being positioned absolutely within a span
.
Feel free to explore this demo
The HTML structure is as follows:
<div class="icon-wrapper">
<i class="fa fa-envelope fa-5x fa-border icon-grey"></i>
<span class="badge">100</span>
</div>
The accompanying CSS rules are outlined below:
.icon-wrapper{
position:relative;
float:left;
}
*.icon-blue {color: #0088cc}
*.icon-grey {color: grey}
i {
width:100px;
text-align:center;
vertical-align:middle;
}
.badge{
background: rgba(0,0,0,0.5);
width: auto;
height: auto;
margin: 0;
border-radius: 50%;
position:absolute;
top:-13px;
right:-8px;
padding:5px;
}
I hope you find this solution beneficial.