0
点赞
收藏
分享

微信扫一扫

从右向左展开的过渡动画

秀儿2020 2022-03-30 阅读 56

✨ 想要的效果:



🦭 代码示例: 

<!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>
    <style>
      .card-animation {
        width: 100px;
        height: 100px;
        background-color: skyblue;
        position: absolute;
        top: 100px;
        /* left: 10px; */
        right: 10px;
        transition: width 0.5s, transform 0.5s;
      }

      .card-animation:hover {
        width: calc(90%);
      }
    </style>
  </head>
  <body>
    <div>
      <div class="card-animation"></div>
    </div>
  </body>
</html>

⭐️ 关键点:

        如果card-animation这个类名里的属性设置right的话就是从右边向左边。
        如果设置的是left的话就是从左边向右边

举报

相关推荐

0 条评论