• 纯css html 真实水滴效果


    惯例,不多说直接上图

    在这里插入图片描述
    原理呢,也很简单,就是使用边框控制box的形状,让它看起来像水滴,然后给它添加一些阴影
    遵循开源精神,源码就直接放下面了,

    DOCTYPE html>
    <html>
    <head>
      <meta charset="UTF-8" />
      <title>whatertitle>
      <style>
        * {
          margin: 0;
          padding: 0;
          box-sizing: border-box;
        }
    
        body {
          display: flex;
          justify-content: center;
          align-items: center;
          min-height: 100vh;
          background: #edeeed;
        }
    
        body>div {
          position: relative;
          display: flex;
          justify-content: center;
          align-items: center;
        }
    
        body>div>div {
          position: absolute;
          width: 150px;
          height: 150px;
          background: transparent;
          border-radius: 57% 43% 37% 63% / 45% 52% 48% 55%;
          box-shadow: inset 10px 10px 10px rgba(0, 0, 0, 0.05),
            15px 25px 10px rgba(0, 0, 0, 0.1), 15px 20px 20px rgba(0, 0, 0, 0.05),
            inset -10px -10px 15px rgba(255, 255, 255, 0.9);
        }
    
        body>div>div::before {
          content: "";
          position: absolute;
          top: 25px;
          left: 35px;
          background: #fff;
          width: 20px;
          height: 20px;
          border-radius: 42% 58% 37% 63% / 40% 43% 57% 60%;
        }
    
        body>div>div::after {
          content: "";
          position: absolute;
          top: 25px;
          left: 65px;
          background: #fff;
          width: 10px;
          height: 10px;
          border-radius: 57% 43% 37% 63% / 48% 37% 63% 52%;
        }
    
        body>div>div:nth-child(2) {
          transform: scale(0.5) translate(-200px, 180px);
          border-radius: 64% 36% 42% 58% / 42% 37% 63% 58%;
        }
    
        body>div>div:nth-child(3) {
          transform: scale(0.5) translate(280px, 10px);
          border-radius: 49% 51% 42% 58% / 56% 47% 53% 44%;
        }
    
        body>div>div:nth-child(4) {
          transform: scale(0.5) translate(120px, -350px);
          border-radius: 39% 61% 63% 37% / 77% 47% 53% 23%;
        }
    
        body>div>div:nth-child(5) {
          transform: scale(0.3) translate(20px, -350px);
          border-radius: 37% 63% 64% 36% / 53% 65% 35% 47%;
        }
    
        body>div>div:nth-child(6) {
          transform: scale(0.7) translate(-150px, -200px);
          border-radius: 37% 63% 64% 36% / 53% 65% 35% 47%;
        }
    
        body>div>div:nth-child(7) {
          transform: scale(0.4) translate(-400px, -100px);
          border-radius: 37% 63% 64% 36% / 53% 65% 35% 47%;
        }
      style>
    head>
    
    <body>
      <div>
        <div>div>
        <div>div>
        <div>div>
        <div>div>
        <div>div>
        <div>div>
        <div>div>
      div>
    body>
    
    html>
    
    • 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
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54
    • 55
    • 56
    • 57
    • 58
    • 59
    • 60
    • 61
    • 62
    • 63
    • 64
    • 65
    • 66
    • 67
    • 68
    • 69
    • 70
    • 71
    • 72
    • 73
    • 74
    • 75
    • 76
    • 77
    • 78
    • 79
    • 80
    • 81
    • 82
    • 83
    • 84
    • 85
    • 86
    • 87
    • 88
    • 89
    • 90
    • 91
    • 92
    • 93
    • 94
    • 95
    • 96
    • 97
    • 98
    • 99
    • 100
    • 101
    • 102
    • 103
    • 104
    • 105
  • 相关阅读:
    day33-JSON&Ajax01
    Python之设计模式
    Kernel Memory 入门系列:文档预处理
    数据向好,分析师预测美联储GDP或将翻一番?
    IB音乐课难不难?
    Geode安装管理指南
    正则表达式
    户外运动耳机推荐、这几款性能超强的户外运动耳机不可错过
    Fiori 应用通过 Adaptation Project 的增强方式分享
    原来引用还有这么多不为人知的秘密呢?
  • 原文地址:https://blog.csdn.net/weixin_44368963/article/details/133387166