过渡

通过过渡可以指定一个属性发生变化的切换方式

通过过渡可以创建一些非常好的效果,提升了用户体验

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <style>
    #div1 {
      width: 200px;
      height: 200px;
      background-color: aquamarine;
    }
    #div1:hover {
      width: 800px;
      height: 800px;
      background-color: red;
      /* 过渡前的延迟时间 */
      transition-delay: 2s;
      /* 过渡的持续时间 */
      transition-duration: 10s;
      /*  */
    }
  </style>
  <body>
    <div id="div1"></div>
  </body>
</html>

 

posted @ 2022-03-26 22:08  罗砂  阅读(37)  评论(0)    收藏  举报