zoukankan      html  css  js  c++  java
  • CSS3网页加载动画

    本篇文章分享纯CSS+HTML加载动画代码

    主要用到css3的动画

    HTML代码如下

    <div id="start-screen">
            <div class="in-start">
                <div class="first"></div>
                <div class="second"></div>
                <div class="third"></div>
            </div>
        </div>

    CSS代码如下:

    html {
    height: 100%;
    }
    
    body {
      height: 100%;
    }
    
    #start-screen {
      height: 100%;
      width: 100%;
      background-color: #ccc;
      opacity: 80%;
      position: fixed;
      z-index: 999;
    }
    
    .in-start {
      height: 50px;
      width: 50px;
      position: absolute;
      margin-top: -45px;
      margin-left: -25px;
      top: 50%;
      left: 50%;
    }
    
    .in-start .first,
    .in-start .second,
    .in-start .third {
      height: 25px;
      width: 25px;
      position: absolute;
      float: left;
      border-radius: 50%;
    }
    
    .first {
      background-color: #ff0;
      animation: fir 1s linear 0.1s infinite;
      top: 0;
      left: 0;
    }
    
    .second {
      background-color: #0f0;
      animation: sec 1s linear 0.2s infinite;
      top: 0;
      left: 25px;
    }
    
    .third {
      background-color: #00f;
      animation: thi 1s linear 0s infinite;
      top: 25px;
      left: 0;
    }
    
    @keyframes fir {
      0% {
        top: 0;
        left: 0;
      }
      25% {
        top: 25px;
        left: 0;
      }
      50% {
        top: 25px;
        left: 25px;
      }
      75% {
        top: 0px;
        left: 25px;
      }
    }
    
    @keyframes sec {
      0% {
        top: 0;
        left: 25px;
      }
      25% {
        top: 0;
        left: 0;
      }
      50% {
        top: 25px;
        left: 0;
      }
      75% {
        top: 25px;
        left: 25px;
      }
    }
    
    @keyframes thi {
      0% {
        top: 25px;
        left: 0;
      }
      25% {
        top: 25px;
        left: 25px;
      }
      50% {
        top: 0;
        left: 25px;
      }
      75% {
        top: 0;
        left: 0;
      }
    }

    网页加载完成后, 可以用JS移除根元素

  • 相关阅读:
    springboot~gradle4.7之后的lombok引用方法
    fzu 2107 Hua Rong Dao(状态压缩)
    jquery 按钮效果 正常、移上、按下
    HDU4550+贪心
    谈mvc开发中gzip压缩的应用
    GET方法传递中文参数乱码解决办法
    游戏开发工具之纹理打包器-3.使用GDI+绘图
    处理机调度
    Adroid学习系列-入门(1)
    Drupal 7.23版本升级笔记
  • 原文地址:https://www.cnblogs.com/jedenzhan/p/8969992.html
Copyright © 2011-2022 走看看