JSFiddle - React, Tailwind, and code Playground
by joepenzo
HTML
<a class="playbtn"></a>
CSS
.playbtn {
background-repeat: no-repeat;
font: 0/0 a;
color: transparent;
text-shadow: none;
background-color: transparent;
border: 0;
z-index: 1;
position: relative;
display: block;
float: left;
cursor:pointer;
}
.playbtn:hover {
}
.playbtn {
background-image: url(http://joepsuijkerbuijk.com/development/img/playbtn-spritesheet.jpg);
/* width and height of each frame */
width: 51px;
height: 58px;
}
.playbtn:hover {
-webkit-animation: sprite-animation .2s steps(4,end) 0; /* steps = number of frames */
animation: sprite-animation .2s steps(4,end) 0;
}
@-webkit-keyframes sprite-animation { /* Safari & Chrome */
from { background-position: 0 0; }
to { background-position: 0 -232px; } /* negative of sprite sheet height */
}
@keyframes sprite-animation {
from { background-position: 0 0; }
to { background-position: 0 -232px; } /* negative of sprite sheet height */
}