图片飞出效果

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      * {
        margin: 0px;
        padding: 0px;
      }
      div {
        width: 100px;
        height: 150px;
      }
      div.boll {
        border: 1px solid red;
        width: 300px;
        height: 300px;
        background-color: silver;
        margin: 0 auto;
        padding-top: 20px;
      }
      .boll .box {
        background-color: white;
        /* 块元素的垂直布局变为水平布局 */
        float: left;
        /* 过渡时间为2秒 */
        transition: all .2s;
      }
      .boll .box1 {
        background-color: white;
        /* 块元素的垂直布局变为水平布局 */
        float: left;
        margin-left: 5px;
        transition: all .3s;
      }
      .box1:hover, .box:hover {
        transform: translateY(-3px);
        box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
      }
    </style>
  </head>
  <body>
    <div class="boll">
      <div class="box"></div>
      <div class="box1"></div>
    </div>
  </body>
</html>
posted @ 2020-02-17 17:14  玄空2  阅读(168)  评论(0编辑  收藏  举报