• CSS特效(4)——使用 background-blend-mode 制作 hover 效果


    使用 background-blend-mode 制作 hover 效果

    <!DOCTYPE html>
    <html lang="en">
    <head>
      <meta charset="UTF-8">
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      <meta http-equiv="X-UA-Compatible" content="ie=edge">
      <title>Document</title>
      <style>
    
    .pic {
         300px;
        height: 200px;
        margin: 30px;
        float: left;
        background: url('https://user-images.githubusercontent.com/8554143/34238564-52f2ceb6-e63d-11e7-9812-dd987f98e9da.png'),
            linear-gradient(#f00, #00f);
        background-size: cover, 100% 100%;
        background-position: 0 0, -300px 0;
        background-blend-mode: luminosity;
        background-repeat: no-repeat;
        transition: .5s background-position linear;
        cursor: pointer;
    }
    
    .pic1 {
        background-image: url('https://user-images.githubusercontent.com/8554143/34238564-52f2ceb6-e63d-11e7-9812-dd987f98e9da.png'),
            linear-gradient(90deg, #ff5722, #03a9f4); 
    }
    
    .pic2 {
        background-image: url('https://user-images.githubusercontent.com/8554143/34238564-52f2ceb6-e63d-11e7-9812-dd987f98e9da.png'),
            linear-gradient(-180deg, #00bcd4, #fa1a09); 
    }
    
    .pic3 {
        background-image: url('https://user-images.githubusercontent.com/8554143/34238564-52f2ceb6-e63d-11e7-9812-dd987f98e9da.png'),
            linear-gradient(45deg, #ffc107, #3f51b5, #4caf50, #ff0057, #fae105, #5c00ff); 
    }
    
    .pic:hover { 
        background-position: 0 0, 0 0; 
    }
      </style>
    </head>
    <body>
        <div class="pic"></div>
        <div class="pic pic1"></div>
        <div class="pic pic2"></div>
        <div class="pic pic3"></div>
    </body>
    </html>
    
  • 相关阅读:
    spring mvc 源码简要分析
    tomcat 开启远程debug
    jdk1.5-jdk1.9的主要区别
    关于elasticsearch 6.x及其插件head安装(单机与集群)5分钟解决
    mysql主从配置(5分钟解决问题)
    内部类总结
    Colored Sticks
    vim 将tab转为空格
    shell编程
    vim -- 查找和替换
  • 原文地址:https://www.cnblogs.com/janas-luo/p/9604799.html
Copyright © 2020-2023  润新知