Created
June 19, 2017 13:58
-
-
Save nakulrathore/28748cf79b0856301ea96e2623fd876e to your computer and use it in GitHub Desktop.
Twitter heart Animation pure css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank you, it is so beautiful