zoukankan      html  css  js  c++  java
  • 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>
    
  • 相关阅读:
    springboot和springcloud运行在外部tomcat
    kafka-线上单机broker扩容
    kafka集群部署和测试
    k8s-学习笔记2-容器部署nginx负载均衡
    logstash部署
    docker-学习笔记7-dockerfile
    kafka常用命令
    kafka-消费滞后(Lag)监控
    kibana-部署
    es-部署
  • 原文地址:https://www.cnblogs.com/janas-luo/p/9604799.html
Copyright © 2011-2022 走看看