Skip to content

Instantly share code, notes, and snippets.

@nakulrathore
Created June 19, 2017 13:58
Show Gist options
  • Select an option

  • Save nakulrathore/28748cf79b0856301ea96e2623fd876e to your computer and use it in GitHub Desktop.

Select an option

Save nakulrathore/28748cf79b0856301ea96e2623fd876e to your computer and use it in GitHub Desktop.
Twitter heart Animation pure css
<head>
<style>
.heart {
width: 100px;
height: 100px;
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
background: url(https://raw.githubusercontent.com/nakulrathore/materialcolors/gh-pages/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;
}
}
</style>
</head>
<body>
<div class="heart"></div>
</body>
@laocoi

laocoi commented Aug 16, 2021

Copy link
Copy Markdown

Thank you, it is so beautiful

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment