Pure CSS – Animation Effect – Shake

CSS Source Code:

@-webkit-keyframes shake {
	0%, 100% {-webkit-transform: translateX(0);}
	10%, 30%, 50%, 70%, 90% {-webkit-transform: translateX(-10px);}
	20%, 40%, 60%, 80% {-webkit-transform: translateX(10px);}
}

@-moz-keyframes shake {
	0%, 100% {-moz-transform: translateX(0);}
	10%, 30%, 50%, 70%, 90% {-moz-transform: translateX(-10px);}
	20%, 40%, 60%, 80% {-moz-transform: translateX(10px);}
}

@-o-keyframes shake {
	0%, 100% {-o-transform: translateX(0);}
	10%, 30%, 50%, 70%, 90% {-o-transform: translateX(-10px);}
	20%, 40%, 60%, 80% {-o-transform: translateX(10px);}
}

@keyframes shake {
	0%, 100% {transform: translateX(0);}
	10%, 30%, 50%, 70%, 90% {transform: translateX(-10px);}
	20%, 40%, 60%, 80% {transform: translateX(10px);}
}

HTML Source Code:

<!DOCTYPE html>
<html>
<head>
<title>Animation Effects</title>
<style type="text/css">@import url(shake.css);</style> 
<style type="text/css"> 
#animated { 
    width: 90%;
}
#animated:hover { 
    -webkit-animation: shake 1300ms; /* Chrome, Safari 5+ */
    -moz-animation: shake 1300ms; /* Firefox 5-15 */
    -o-animation: shake 1300ms; /* Opera 12.00 */
    animation: shake 1300ms; /* Chrome, Firefox 16+, IE 10+, Opera 12.10+ */
} 
</style>
</head>
 
<body>
Mouseover thumbnail to see the effect
<table style="width:100%;margin-top:30px;">
<tr>
    <td><img id="animated" src="images/thumb1.jpg" > </td>
    <td><img id="animated" src="images/thumb2.jpg" > </td>
    <td><img id="animated" src="images/thumb3.jpg" > </td>
    <td><img id="animated" src="images/thumb4.jpg" > </td>
  </tr>
</table>
</body>
 
</html>
DEMO

 

My official WebSite >