Horje Website
CSS3 Shake Animation – Shake animation – CSS Code

CSS3 Shake Animation – Shake animation

CSS3 Shake Animation - Shake animation - CSS Code


 
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>Example of CSS3 Shake Animation</title>
  6. <style>
  7. .box {
  8. margin: 50px;
  9. width:120px;
  10. height:110px;
  11. background: url("/examples/images/star-fish-transparent.png") no-repeat;
  12. position: relative;
  13. left: 0;
  14. /* Chrome, Safari, Opera */
  15. -webkit-animation-name: shakeit;
  16. -webkit-animation-duration: 2s;
  17. /* Standard syntax */
  18. animation-name: shakeit;
  19. animation-duration: 2s;
  20. }
  21. /* Chrome, Safari, Opera */
  22. @-webkit-keyframes shakeit {
  23. 12.5% {left: -50px;}
  24. 25% {left: 50px;}
  25. 37.5% {left: -25px;}
  26. 50% {left: 25px;}
  27. 62.5% {left: -10px;}
  28. 75% {left: 10px;}
  29. }
  30. /* Standard syntax */
  31. @keyframes shakeit {
  32. 12.5% {left: -50px;}
  33. 25% {left: 50px;}
  34. 37.5% {left: -25px;}
  35. 50% {left: 25px;}
  36. 62.5% {left: -10px;}
  37. 75% {left: 10px;}
  38. }
  39. </style>
  40. </head>
  41. <body>
  42. <p><strong>Note:</strong> Click the "Show Output" button to repeat the animation.</p>
  43. <div class="box"></div>
  44. </body>
  45. </html>



Try Your Self ->



Published:
September 4, 2020
Author:
admin
Category:
CSS Source Code, CSS3 Examples
Views:
19

This article was posted in CSS Source Code, CSS3 Examples and tagged , , . Bookmark the permalink. Follow comments with the RSS feed for this post.Post a Comment or leave a trackback: Trackback URL.

Leave a Reply

Your email address will not be published. Required fields are marked *

 

Horje © 2011 - 2022