• 毛玻璃用户卡交互


    效果展示

    在这里插入图片描述

    页面结构组成

    从效果展示可以看到,此效果都是比较常规的。主要的核心就是卡片的悬停效果。

    CSS 知识点

    • backdrop-filter 回顾
    • transition
    • transform

    页面基础布局实现

    <section>
      <div class="container">
        <div class="card">
          <div class="img_box">
            <img src="./images/user-1.jpg" />
          div>
          <div class="content">
            <div class="content_box">
              <h3>
                Someone Famous
                <br />
                <span>Creative Designerspan>
              h3>
            div>
            <ul>
              <li style="--i: 1">
                <a href="#"><i class="fa fa-qq" aria-hidden="true">i>a>
              li>
              <li style="--i: 2">
                <a href="#"><i class="fa fa-weixin" aria-hidden="true">i>a>
              li>
              <li style="--i: 3">
                <a href="#"><i class="fa fa-weibo" aria-hidden="true">i>a>
              li>
              <li style="--i: 4">
                <a href=" #"
                  ><i class="fa fa-tencent-weibo" aria-hidden="true">i
                >a>
              li>
            ul>
          div>
        div>
      div>
    section>
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34

    实现卡片样式

    .container .card {
      position: relative;
      width: 300px;
      height: 400px;
      margin: 20px;
      overflow: hidden;
      box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
      border-radius: 15px;
      display: flex;
      justify-content: center;
      align-items: center;
    }
    
    .container .card .img_box {
      width: 100%;
      height: 100%;
    }
    
    .container .card .img_box img {
      display: flex;
      width: 100%;
      height: 100%;
      object-fit: cover;
    }
    
    .container .card .content {
      position: absolute;
      bottom: -160px;
      width: 100%;
      height: 160px;
      display: flex;
      justify-content: center;
      align-items: center;
      z-index: 10;
      flex-flow: row wrap;
      backdrop-filter: blur(15px);
      box-shadow: 0 -10px 10px rgba(0, 0, 0, 0.1);
      border: 1px solid rgba(255, 255, 255, 0.2);
      transition: 0.5s;
    }
    
    .container .card:hover .content {
      bottom: 0;
    }
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44

    社交图标实现

    .container .card .content ul {
      position: relative;
      bottom: 10px;
      display: flex;
    }
    
    .container .card .content ul li {
      list-style: none;
      margin: 0 10px;
      transform: translateY(40px);
      transition: 0.5s;
      opacity: 0;
      transition-delay: calc(0.2s * var(--i));
    }
    
    .container .card:hover .content ul li {
      opacity: 1;
      transform: translateY(0px);
    }
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19

    完整代码下载

    完整代码下载

  • 相关阅读:
    Maven
    PING(计算机网络)
    postman打开后,以前的接口记录不在,问题解决
    c++标准模板(STL)- 算法 (std::remove, std::remove_if)
    React ReactRouter6、组件的调整、hooks(笔记)
    我好像洞察到二叉树路径和的秘密
    代码出炉结构乱?Maven整理省心办。
    常用的openssl命令
    怎样在LaTeX中方便输入带圆圈的数字
    Spring之aop
  • 原文地址:https://blog.csdn.net/qq_33003143/article/details/133487080