Skip to content

Instantly share code, notes, and snippets.

@owngeek
Last active August 31, 2016 11:40
Show Gist options
  • Save owngeek/2f4baae027c397fa16fd40984642da95 to your computer and use it in GitHub Desktop.
Save owngeek/2f4baae027c397fa16fd40984642da95 to your computer and use it in GitHub Desktop.
<style>
div {
width: 100px;
height: 100px;
background-color: #990;
position: absolute;
left: 0;
-webkit-animation-name: example; /* Chrome, Safari, Opera */
-webkit-animation-duration: 4s; /* Chrome, Safari, Opera */
animation-name: example;
animation-duration: 4s;
}
.vv {
width: 100px;
height: 100px;
background-color: #137bad;
position: absolute;
left: 0;
top: 250px;
-webkit-animation-name: example2; /* Chrome, Safari, Opera */
-webkit-animation-duration: 4s; /* Chrome, Safari, Opera */
animation-name: example2;
animation-duration: 4s;
}
/* Chrome, Safari, Opera */
@-webkit-keyframes example {
from {
left:0px;
}
to {
left: 150px;
}
background-color: #990;
}
/* Standard syntax */
@keyframes example {
from {
left:0px;
}
to {
left: 150px;
}
}
/* Chrome, Safari, Opera */
@-webkit-keyframes example2 {
0% {
left:0px;
background-color: #137bad;
}
25% {
left:100px;
background-color: #4e4e4e;
}
50% {
left:150px;
background-color: #137bad;
}
75% {
left:100px;
background-color: #4e4e4e;
}
100% {
left:0px;
background-color: #137bad;
}
}
/* Standard syntax */
@keyframes example2 {
0% {
left:0px;
background-color: #137bad;
}
25% {
left:100px;
background-color: #4e4e4e;
}
50% {
left:150px;
background-color: #137bad;
}
75% {
left:100px;
background-color: #4e4e4e;
}
100% {
left:0px;
background-color: #137bad;
}
}
</style>
<p style="font-size:14px;"><b>Note:</b> This example does not work in Internet Explorer 9 and earlier versions.</p>
<div></div>
<div class="vv"></div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment