Skip to content

Instantly share code, notes, and snippets.

@dziudek
Created March 28, 2012 13:55
Show Gist options
  • Save dziudek/2226388 to your computer and use it in GitHub Desktop.
Save dziudek/2226388 to your computer and use it in GitHub Desktop.
Rotating elements :)
/**
* Rotating elements :)
*/
body > div {
background: #eee;
}
div > div {
width: 100px;
height: 100px;
background: #a00;
animation-name: rotateback;
animation-iteration-count: 1;
animation-duration: 0.5s;
animation-direction: alternate;
animation-fill-mode: both;
}
div:hover > div,
div > div.active {
animation-name: rotate;
animation-iteration-count: 1;
animation-duration: 0.5s;
animation-direction: alternate;
animation-fill-mode: both;
}
div:hover > div.active {
animation-duration: 0s;
}
@keyframes rotate {
from { transform: rotateY(0deg); background: #a00; }
49% { background: #a00; }
50% { transform: rotateY(90deg); background: #0a0; }
to { transform: rotateY(0deg); background: #0a0; }
}
@keyframes rotateback {
from { transform: rotateY(0deg); background: #0a0; }
49% { transform: rotateY(90deg); background: #0a0; }
50% { background: #a00; }
to { transform: rotateY(0deg); background: #a00; }
}
<!-- content to be placed inside <body>…</body> -->
<div>
<div class="activ">Lorem</div>
</div>
{"view":"split","seethrough":"","prefixfree":"1","page":"css"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment