<a class="gif" href="#"><img src="animation.gif" alt="" /></a>
.gif {
display: block;
background: url('stat.gif') no-repeat;
}
a.gif img {
visibility: hidden;
}
a.gif:hover {
background: none;
}
a.gif:hover img {
visibility: visible;
border:0;
}
Looping is encoded into the GIF itself, not the img tag. Open the GIF in an image editor and change the mode to loop, or use a different GIF. The loop attribute is an invalid, deprecated attribute only meant to work when the src is a video.