Css实现鼠标移动图片上光亮效果

<html>
  <head>
    <title>Css实现鼠标移动图片上光亮效果</title>
  </head>
  <style>
    .demo {
      position: relative;
      overflow: hidden;
      background: #000;
      width: 400px;
      height: 230px;
    }
    .demo:before {
      content: "";
      cursor: pointer;
      position: absolute;
      left: -120%;
      top: 0;
      width: 100%;
      height: 100%;
      mix-blend-mode: overlay;
      background-image: -moz-linear-gradient(
        0deg,
        rgba(255, 255, 255, 0),
        rgba(255, 255, 255, 0.5),
        rgba(255, 255, 255, 0)
      );
      background-image: -webkit-linear-gradient(
        0deg,
        rgba(255, 255, 255, 0),
        rgba(255, 255, 255, 0.5),
        rgba(255, 255, 255, 0)
      );
      transform: skewx(-25deg);
      z-index: 1;
    }
    .demo:hover:before {
      left: 120%;
      -moz-transition: 1s;
      -o-transition: 1s;
      -webkit-transition: 1s;
      transition: 1s;
    }
  </style>
  <body>
    <div class="demo">
      <img
        src="https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg"
      />
    </div>
  </body>
</html>
posted @ 2025-08-11 15:05  蜗牛snail  阅读(1)  评论(0)    收藏  举报
蜗牛前端 蜗牛文学