zoukankan      html  css  js  c++  java
  • 1.HTML+CSS写个8

    感想: 有点缺陷。效果地址:https://codepen.io/flyingliao/pen/QobdyE

    HTML code:

    <div class="eight">
      <span><span></span></span>
      <span></span>
    </div>

    CSS code:

    html, body ,.eight{
        margin: 0;
        padding: 0;
    }
    body{
        height: 100vh;
        display: flex;
        justify-content: center;
        align-items: center;
        flex-direction: column;
    }
    .eight{
        width: 80px;
        height: 160px;
    }
    .eight>span{
        display: block;
        width: 100%;
        height: 50%;
        border: 1px solid white;
        border-radius: 50%;
        transform: rotate(-45deg);
    }
    
    .eight span:first-child{
        /* alternate: 动画轮流反向播放 ;
        forwards: 动画完成保持最后一个属性值;
        animation-name: write1;
        animation-duration: 2s;
        animation-timing-function: ease-in;
        animation-iteration-count:1;
        animation-fill-mode: forwards;
       */
        animation: write1 2s ease-in 1 forwards;
    }
    .eight span:last-child{
        margin-top: -1px;
        animation: write2 4s ease-in 2s forwards;
    }
    .eight>span:first-child>span{
        position: absolute;
        top: 0;
        left: 0;
        width: 80px;
        height: 80px;
        border: 1px solid white;
        border-radius: 50%;
        transform: rotate(-deg45);
        animation: write3 2s ease-in 3s forwards;
    }
    @keyframes write1{
       0%{
          border-top-color: white;
          border-left-color: white;
       }
       100%{
          border-top-color: red;
          border-left-color: red;
       }
    }
    @keyframes write2{
        0%{
            border-right-color: white;
        }
        25%{
            border-right-color: red;
        }
        50%{
            border-right-color: red;
            border-bottom-color: red;
        }
        75%{
            border-right-color: red;
            border-bottom-color: red;
            border-left-color: red;
        }
        100%{
            border-color: red;
        }
    }
    @keyframes write3{
        0%{
           border-bottom-color: white;
           border-right-color: white;
        }
       100%{
           border-bottom-color: red;
           border-right-color: red;
       }
    }
  • 相关阅读:
    html5对分辨率和设备的嗅探方法
    给前端苦手的同学们一点建议——前端之所以难学,可能的原因
    css3学习笔记
    关于viewport的一些问题
    js通过as完成socket通信
    【数学】数论常识
    AbstractFactory 模式
    State 模式
    Strategy 模式
    error LNK2001
  • 原文地址:https://www.cnblogs.com/FlyingLiao/p/10446650.html
Copyright © 2011-2022 走看看