zoukankan      html  css  js  c++  java
  • css秘密花园一

    css秘密花园

      1.透明边框

    <style>
        div{
           120px;
          height: 60px;
          margin: 30px auto;
          background: pink;
          border: 10px solid hsla(0, 0%, 100%, .5)
        }
      </style>
    
    <body>
      <main>
        <div></div>
      </main>
    </body>

      2.css多重边框

    <style>
        div{
          width: 60px;
          height: 60px;
          margin: 50px auto;
          background: pink;
          border-radius: 50%;
          box-shadow: 0 0 0 10px #ccc,0 0 0 20px #777,
                      0 0 0 30px #ccc,0 0 0 40px #777;
        }
      </style>
    
    <body>
      <main>
        <div></div>
      </main>
    </body>
    <style>
        div{
          width: 120px;
          height: 60px;
          margin: 50px auto;
          background: pink;
          border: 10px solid #ccc;
          outline: 10px solid #ccc;
          outline-offset: -30px;
        }
      </style>
    
    <body>
      <main>
        <div></div>
      </main>
    </body

       3.css内圆角

    <style>
        div{
          width: 120px;
          height: 60px;
          margin: 50px auto;
          background: pink;
          border: 5px solid #cccccc;
          border-radius: 15px;
          outline: 5px solid #ccc;
          outline-offset: -5px;
        }
      </style>
    <body>
      <main>
        <div></div>
      </main>
    </body>
     
    <style>
        div{
          width: 120px;
          height: 60px;
          margin: 50px auto;
          background: pink;
          border-radius: 8px;
          outline: 5px solid #ccc;
          box-shadow: 0 0 0 3px #ccc;
        }
      </style>
    <body>
      <main>
        <div></div>
      </main>
    </body>

       4.滚动的进度条

    <style>
        main{
          width: 800px;
          height: 60px;
          margin: 50px auto;
        }
        .progress-bar{
          width: 100%;
          height: 12px;
          border-radius: 6px;
          overflow: hidden;
          position: relative;
        }
        .progress-enter{
          height: inherit;
          background:pink;
          opacity: .5;
        }
        .progress-bg{
          width: 60%;
          height: inherit;
          border-radius: 6px;
          background: repeating-linear-gradient(-45deg,#d9cfbb 25%,#C3B393 0, #C3B393 50%,
                                              #D9CFBB 0, #D9CFBB 75%, #C3B393 0);
                                              /* 背景斑马条纹 */
          background-size: 16px 16px;
          animation: panoramic 20s linear infinite;
          /* animation 参数依次是 动画名称,一个动画周期持续事件 ,infinite代表循环播放 linear直线*/
        }
        @keyframes panoramic {
          to{
            background-position: 200% 0;
          }
        }
      </style>
    <body>
      <main>
        <div class="progress-bar">
          <div class="progress-enter">
            <div class="progress-bg"></div>
          </div>
        </div>
      </main>
    </body>

    会动的

       5.一像素横线 主要是手机端问题,有时候1px不是1px 

        使用box-show 配合transform: scale(.5) translateZ(0)

    <style>
        main{
          width: 800px;
          height: 60px;
          margin: 50px auto;
          display: flex;
        }
        span{
          width: 100%;
          position: relative;
        }
        span::after{
          content: '';
          width: 100%;
          position: absolute;
          box-shadow: 0 0 0 1px #b4a078;
          transform-origin: 0 bottom;
          transform: scale(.5) translateZ(0);
        }
        @media (min-resolution: 2dppx){
          span::after{
            box-shadow: 0 0 0 .5px #b4a078;
          }
        }
        @media (min-resolution: 3dppx){
          span::after{
            box-shadow: 0 0 0 .3333px #b4a078;
          }
        }
      </style>
    
    <body>
      <main>
        <span>
    
        </span>
      </main>
    </body>

    参考地址 https://lhammer.cn/You-need-to-know-css/#/translucent-borders

  • 相关阅读:
    【luogu P7418】Counting Graphs P(DP)(思维)(容斥)
    【luogu P7417】Minimizing Edges P(贪心)(思维)
    多边形序列(组合数)(高精)(NTT)
    【luogu P3803】【模板】多项式乘法(NTT)
    【luogu P1919】【模板】A*B Problem升级版(FFT快速傅里叶)
    【luogu P6139】【模板】广义后缀自动机(广义 SAM)
    【luogu P7529】Permutation G(几何)(数学)(DP)
    【luogu P5787】graph / 二分图 /【模板】线段树分治(扩展域并查集)(线段树分治)
    同桌的你(环套树)(DP)
    石子游戏(博弈论)(Spaly)
  • 原文地址:https://www.cnblogs.com/czkolve/p/10981723.html
Copyright © 2011-2022 走看看