温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

10种CSS3实现的loading动画的方式介绍

发布时间:2021-03-16 17:15:40 阅读:325 作者:TREX 栏目:web开发
前端开发者测试专用服务器限时活动,0元免费领,库存有限,领完即止! 点击查看>>

本篇内容主要讲解“10种CSS3实现的loading动画的方式介绍”,感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让小编来带大家学习“10种CSS3实现的loading动画的方式介绍”吧!

效果

10种CSS3实现的loading动画的方式介绍

html

<body>
  <div class="content">
    <h4>CSS3 Loading animations</h4>
    <div class="load-wrapp">
      <div class="load-1">
        <p>Loading 1</p>
        <div class="line"></div>
        <div class="line"></div>
        <div class="line"></div>
      </div>
    </div>
    <div class="load-wrapp">
      <div class="load-2">
        <p>Loading 2</p>
        <div class="line"></div>
        <div class="line"></div>
        <div class="line"></div>
      </div>
    </div>
    <div class="load-wrapp">
      <div class="load-3">
        <p>Loading 3</p>
        <div class="line"></div>
        <div class="line"></div>
        <div class="line"></div>
      </div>
    </div>
    <div class="load-wrapp">
      <!-- Loading 4 don't work on firefox because of the border-radius and the "dashed" style. -->
      <div class="load-4">
        <p>Loading 4</p>
        <div class="ring-1"></div>
      </div>
    </div>
    <div class="load-wrapp">
      <div class="load-5">
        <p>Loading 5</p>
        <div class="ring-2">
          <div class="ball-holder">
            <div class="ball"></div>
          </div>
        </div>
      </div>
    </div>
    <div class="load-wrapp">
      <div class="load-6">
        <p>Loading 6</p>
        <div class="letter-holder">
          <div class="l-1 letter">L</div>
          <div class="l-2 letter">o</div>
          <div class="l-3 letter">a</div>
          <div class="l-4 letter">d</div>
          <div class="l-5 letter">i</div>
          <div class="l-6 letter">n</div>
          <div class="l-7 letter">g</div>
          <div class="l-8 letter">.</div>
          <div class="l-9 letter">.</div>
          <div class="l-10 letter">.</div>
        </div>
      </div>
    </div>
    <div class="load-wrapp">
      <div class="load-7">
        <p>Loading 7</p>
        <div class="square-holder">
          <div class="square"></div>
        </div>
      </div>
    </div>
    <div class="load-wrapp">
      <div class="load-8">
        <p>Loading 8</p>
        <div class="line"></div>
      </div>
    </div>
    <div class="load-wrapp">
      <div class="load-9">
        <p>Loading 9</p>
        <div class="spinner">
          <div class="bubble-1"></div>
          <div class="bubble-2"></div>
        </div>
      </div>
    </div>
    <div class="load-wrapp">
      <div class="load-10">
        <p>Loading 10</p>
        <div class="bar"></div>
      </div>
    </div>
  </div>
  <div class="clear"></div>
</body>

css3

/* -----------------------------------------
  =Default css to make the demo more pretty
-------------------------------------------- */

body {
  margin0 auto;
  padding20px;
  max-width1200px;
  overflow-y: scroll;
  font-family"Open Sans", sans-serif;
  font-weight400;
  color#777;
  background-color#f7f7f7;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  -ms-text-size-adjust: 100%;
}

.content {
  padding15px;
  overflow: hidden;
  background-color#e7e7e7;
  background-colorrgba(0000.06);
}

h2 {
  padding-bottom15px;
  border-bottom1px solid #d8d8d8;
  font-weight600;
}

h2 span {
  font-family: monospace, serif;
}

h4 {
  padding-bottom20px;
  box-shadow0 1px 0 rgba(0000.1), 0 2px 0 rgba(2552552550.9);
}

p {
  margin0;
  padding10px 0;
  color#777;
}

.clear {
  clear: both;
}

/* -----------------------------------------
  =CSS3 Loading animations
-------------------------------------------- */

/* =Elements style
---------------------- */
.load-wrapp {
  float: left;
  width100px;
  height100px;
  margin0 10px 10px 0;
  padding20px 20px 20px;
  border-radius5px;
  text-align: center;
  background-color#d8d8d8;
}

.load-wrapp p {
  padding0 0 20px;
}
.load-wrapp:last-child {
  margin-right0;
}

.line {
  display: inline-block;
  width15px;
  height15px;
  border-radius15px;
  background-color#4b9cdb;
}

.ring-1 {
  width10px;
  height10px;
  margin0 auto;
  padding10px;
  border7px dashed #4b9cdb;
  border-radius100%;
}

.ring-2 {
  position: relative;
  width45px;
  height45px;
  margin0 auto;
  border4px solid #4b9cdb;
  border-radius100%;
}

.ball-holder {
  position: absolute;
  width12px;
  height45px;
  left17px;
  top0px;
}

.ball {
  position: absolute;
  top: -11px;
  left0;
  width16px;
  height16px;
  border-radius100%;
  background#4282b3;
}

.letter-holder {
  padding16px;
}

.letter {
  float: left;
  font-size14px;
  color#777;
}

.square {
  width12px;
  height12px;
  border-radius4px;
  background-color#4b9cdb;
}

.spinner {
  position: relative;
  width45px;
  height45px;
  margin0 auto;
}

.bubble-1,
.bubble-2 {
  position: absolute;
  top0;
  width25px;
  height25px;
  border-radius100%;
  background-color#4b9cdb;
}

.bubble-2 {
  top: auto;
  bottom0;
}

.bar {
  float: left;
  width15px;
  height6px;
  border-radius2px;
  background-color#4b9cdb;
}

/* =Animate the stuff
------------------------ */
.load-1 .line:nth-last-child(1) {
  animation: loadingA 1.5s 1s infinite;
}
.load-1 .line:nth-last-child(2) {
  animation: loadingA 1.5s 0.5s infinite;
}
.load-1 .line:nth-last-child(3) {
  animation: loadingA 1.5s 0s infinite;
}

.load-2 .line:nth-last-child(1) {
  animation: loadingB 1.5s 1s infinite;
}
.load-2 .line:nth-last-child(2) {
  animation: loadingB 1.5s 0.5s infinite;
}
.load-2 .line:nth-last-child(3) {
  animation: loadingB 1.5s 0s infinite;
}

.load-3 .line:nth-last-child(1) {
  animation: loadingC 0.6s 0.1s linear infinite;
}
.load-3 .line:nth-last-child(2) {
  animation: loadingC 0.6s 0.2s linear infinite;
}
.load-3 .line:nth-last-child(3) {
  animation: loadingC 0.6s 0.3s linear infinite;
}

.load-4 .ring-1 {
  animation: loadingD 1.5s 0.3s cubic-bezier(0.170.370.430.67) infinite;
}

.load-5 .ball-holder {
  animation: loadingE 1.3s linear infinite;
}

.load-6 .letter {
  animation-name: loadingF;
  animation-duration1.6s;
  animation-iteration-count: infinite;
  animation-direction: linear;
}

.l-1 {
  animation-delay0.48s;
}
.l-2 {
  animation-delay0.6s;
}
.l-3 {
  animation-delay0.72s;
}
.l-4 {
  animation-delay0.84s;
}
.l-5 {
  animation-delay0.96s;
}
.l-6 {
  animation-delay1.08s;
}
.l-7 {
  animation-delay1.2s;
}
.l-8 {
  animation-delay1.32s;
}
.l-9 {
  animation-delay1.44s;
}
.l-10 {
  animation-delay1.56s;
}

.load-7 .square {
  animation: loadingG 1.5s cubic-bezier(0.170.370.430.67) infinite;
}

.load-8 .line {
  animation: loadingH 1.5s cubic-bezier(0.170.370.430.67) infinite;
}

.load-9 .spinner {
  animation: loadingI 2s linear infinite;
}
.load-9 .bubble-1,
.load-9 .bubble-2 {
  animation: bounce 2s ease-in-out infinite;
}
.load-9 .bubble-2 {
  animation-delay: -1s;
}

.load-10 .bar {
  animation: loadingJ 2s cubic-bezier(0.170.370.430.67) infinite;
}

@keyframes loadingA {
  0 {
    height15px;
  }
  50% {
    height35px;
  }
  100% {
    height15px;
  }
}

@keyframes loadingB {
  0 {
    width15px;
  }
  50% {
    width35px;
  }
  100% {
    width15px;
  }
}

@keyframes loadingC {
  0 {
    transformtranslate(00);
  }
  50% {
    transformtranslate(015px);
  }
  100% {
    transformtranslate(00);
  }
}

@keyframes loadingD {
  0 {
    transformrotate(0deg);
  }
  50% {
    transformrotate(180deg);
  }
  100% {
    transformrotate(360deg);
  }
}

@keyframes loadingE {
  0 {
    transformrotate(0deg);
  }
  100% {
    transformrotate(360deg);
  }
}

@keyframes loadingF {
  0% {
    opacity0;
  }
  100% {
    opacity1;
  }
}

@keyframes loadingG {
  0% {
    transformtranslate(00rotate(0deg);
  }
  50% {
    transformtranslate(70px0rotate(360deg);
  }
  100% {
    transformtranslate(00rotate(0deg);
  }
}

@keyframes loadingH {
  0% {
    width15px;
  }
  50% {
    width35px;
    padding4px;
  }
  100% {
    width15px;
  }
}

@keyframes loadingI {
  100% {
    transformrotate(360deg);
  }
}

@keyframes bounce {
  0%,
  100% {
    transformscale(0);
  }
  50% {
    transformscale(1);
  }
}

@keyframes loadingJ {
  0%,
  100% {
    transformtranslate(00);
  }

  50% {
    transformtranslate(80px0);
    background-color#f5634a;
    width25px;
  }
}

到此,相信大家对“10种CSS3实现的loading动画的方式介绍”有了更深的了解,不妨来实际操作一番吧!这里是亿速云网站,更多相关内容可以进入相关频道进行查询,关注我们,继续学习!

亿速云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

原文链接:https://www.jb51.net/css/752447.html

AI

开发者交流群×