Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@CodeMyUI
Forked from anonymous/Twitter Heart.markdown
Created November 12, 2015 11:13
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save CodeMyUI/2bdf6f0353a2d776ffbb to your computer and use it in GitHub Desktop.
Save CodeMyUI/2bdf6f0353a2d776ffbb to your computer and use it in GitHub Desktop.
Twitter Heart
<div class="heart"></div>
.heart {
width: 100px;
height: 100px;
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
background: url(https://cssanimation.rocks/assets/images/posts/steps/heart.png) no-repeat;
background-position: 0 0;
cursor: pointer;
animation: fave-heart 1s steps(28);
}
.heart:hover {
background-position: -2800px 0;
transition: background 1s steps(28);
}
@keyframes fave-heart {
0% {
background-position: 0 0;
}
100% {
background-position: -2800px 0;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment