philchanet
1/26/2017 - 8:27 AM

CSS attr() function

CSS attr() function

<div class="likebutton" data-likes="1">Like</div>
.likebutton{
  width:100px;
  border:1px solid blue;
}
.likebutton:before{
  color: #FFFFFF;
  content: attr(data-likes);
  background:blue;
  display: inline-block;
  padding: 15px;
  margin-right: 15px;
}