Created
October 23, 2012 13:51
-
-
Save folksilva/3938858 to your computer and use it in GitHub Desktop.
Efeito css botão rolante
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
/** | |
* Supondo que a imagem de fundo do botão tenha os 3 estados, cada um com 30px de altura e 150px de largura, | |
* totalizando uma imagem de 150x90px. | |
*/ | |
/* Estado inicial */ | |
div#meuBotao { | |
width: 150px; | |
height: 30px; | |
cursor: pointer; | |
background: url('meuBotao-bg.png') top center no-repeat; | |
-webkit-transition: background 1s ease-in-out; | |
-moz-transition: background 1s ease-in-out; | |
-ms-transition: background 1s ease-in-out; | |
-o-transition: background 1s ease-in-out; | |
transition: background 1s ease-in-out; | |
} | |
/* Mouse sobre ou foco */ | |
div#meuBotao:hover, div#meuBotao:focus { | |
background-position: center -30px; | |
} | |
/* Clicado */ | |
div#meuBotao:active { | |
background-position: center -60px; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment