6.transition.html 1.3 KB

1234567891011121314151617181920212223242526272829303132333435
  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-color: red;
  12. /* 过渡:平滑的过渡
  13. transition:
  14. property 执行名称:all width height
  15. duration 时间 执行过渡的时间
  16. timing-function 执行的曲线:
  17. linear 规定以相同速度开始至结束的过渡效果(等于 cubic-bezier(0,0,1,1))。
  18. ease 规定慢速开始,然后变快,然后慢速结束的过渡效果(cubic-bezier(0.25,0.1,0.25,1))。
  19. ease-in 规定以慢速开始的过渡效果(等于 cubic-bezier(0.42,0,1,1))。
  20. ease-out 规定以慢速结束的过渡效果(等于 cubic-bezier(0,0,0.58,1))。
  21. ease-in-out 规定以慢速开始和结束的过渡效果(等于 cubic-bezier(0.42,0,0.58,1))。
  22. delay 延迟时间
  23. */
  24. transition:all 3s linear 5s;
  25. }
  26. #box:hover {
  27. width: 500px;
  28. height: 700px;
  29. }
  30. </style>
  31. </head>
  32. <body>
  33. <div id="box"></div>
  34. </body>
  35. </html>