鼠标移入改变图片颜色hover\drop-shadow

2023-02-07  本文已影响0人  启研
<!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>
    .menu {
      border: 1px solid rgba(138, 138, 138, 0.22);
      box-shadow: 0 2px 6px 0 rgba(138, 138, 138, 0.22);
      border-radius: 6px;
      text-align: center;
      margin-left: 10px;
      padding-bottom: 10px;
    }
    .imgbox{ 
        width: 6vw;
        height: 4vw;
        overflow: hidden;
    }
    img {
        width: 100%;
        height: 100%;
    }
    .menu:hover {
      background-image: linear-gradient(127deg, #02b3ff 0%, #0193f7 60%, #007ef1 100%);
      color: #fff;
      border-radius: 6px;
    }
    .menu:hover img{
        transform:  translateX(0vw) perspective(1);
        position: relative;
        left: -6vw;
        filter: drop-shadow(6vw 0px white);
    }

  </style>
  <body style="display: flex">
    <div class="menu">
      <div class="imgbox">
        <img src="https://www.baidu.com/img/PCtm_d9c8750bed0b3c7d089fa7d55720d6cf.png" />
      </div>
      1
    </div>
    <div class="menu">
      <div class="imgbox">
        <img src="https://www.baidu.com/img/PCtm_d9c8750bed0b3c7d089fa7d55720d6cf.png" />
      </div>
      2
    </div>
  </body>
</html>
上一篇下一篇

猜你喜欢

热点阅读