9.transition.html 1.0 KB

123456789101112131415161718192021222324252627282930313233343536
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <title>Document</title>
  7. <style>
  8. .box {
  9. width: 200px;
  10. height: 200px;
  11. background: #f00;
  12. transition: width 5s ease;
  13. }
  14. .box:hover {
  15. width: 400px;
  16. }
  17. </style>
  18. </head>
  19. <body>
  20. <!--
  21. 动画:
  22. 过渡效果
  23. transition:property duration timing-function delay;
  24. transition-property:执行名称
  25. transition-duration: 执行过渡效果的时间
  26. transition-timing-function: 运动曲线
  27. linear 匀速
  28. ease 规定慢速开始,然后变快,然后慢速结束的过渡效果(
  29. ease-in 规定以慢速开始的过渡效果
  30. ease-out 规定以慢速结束的过渡效果
  31. ease-in-out 规定以慢速开始和结束的过渡效果
  32. transition-delay: 延长时间
  33. -->
  34. <div class="box"></div>
  35. </body>
  36. </html>