Skip to content

Instantly share code, notes, and snippets.

@nicksheffield
Created March 4, 2014 22:26
Show Gist options
  • Select an option

  • Save nicksheffield/9357093 to your computer and use it in GitHub Desktop.

Select an option

Save nicksheffield/9357093 to your computer and use it in GitHub Desktop.
Sprite button in css
.sprite{
background-image: url(button_sprite.png);
background-repeat: no-repeat;
width: 198px; /* width of one button */
height: 54px; /* height of one button */
margin: 2em 0;
/* optional, makes the background slide */
-webkit-transition: background-position 0.1s ease-out;
transition: background-position 0.1s ease-out;
}
.sprite:hover{
background-position: 0 -54px;
}
.sprite:active{
background-position:0 -108px;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment