example_of_css_5.html 719 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>CSS - 动画效果</title>
  6. <style>
  7. #one, #two, #three {
  8. position: fixed;
  9. width: 200px;
  10. height: 200px;
  11. top: 100px;
  12. }
  13. #one {
  14. background-color: purple;
  15. left: 100px;
  16. animation: foo 10s;
  17. }
  18. #two {
  19. background-color: gold;
  20. left: 400px;
  21. animation: foo 2s infinite;
  22. }
  23. #three {
  24. background-color: darkgreen;
  25. left: 700px;
  26. animation: foo 0.5s infinite;
  27. }
  28. @keyframes foo {
  29. from {
  30. transform: rotate(0deg);
  31. }
  32. to {
  33. transform: rotate(360deg);
  34. }
  35. }
  36. </style>
  37. </head>
  38. <body>
  39. <div id="one"></div>
  40. <div id="two"></div>
  41. <div id="three"></div>
  42. </body>
  43. </html>