Skip to content

Instantly share code, notes, and snippets.

@matt-bailey
Created April 26, 2012 10:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matt-bailey/2498745 to your computer and use it in GitHub Desktop.
Save matt-bailey/2498745 to your computer and use it in GitHub Desktop.
Image sprite fading
/* http://css-tricks.com/fade-image-within-sprite/ */
/* HTML - <a href="#" class="arrow">Arrow<span></span></a> */
/* CSS */
.arrow {
display: inline-block;
position: relative;
text-indent: -9999px;
width: 36px;
height: 36px;
background: url(sprites.png) no-repeat;
}
.arrow span {
position: absolute;
top: 0; left: 0; bottom: 0; right: 0;
background: url(sprites.png) no-repeat;
background-position: -50px 0;
opacity: 0;
-webkit-transition: opacity 0.5s;
-moz-transition: opacity 0.5s;
-o-transition: opacity 0.5s;
}
.arrow:hover span {
opacity: 1;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment