你不知道的css动画,但是很实用

上新功能时使用的css动画

先看效果:


效果图

该效果一般用在新上了一个功能.引起提示效果

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
  <style>
    * {
      padding: 0;
      margin: 0;
    }
    html, body{
      width: 100%;
      height: 100%;
    }
    .box {
      margin: 100px auto;
      width: 50px;
      height: 50px;
      /*background: rgba(255,0,0,0.35);*/
      position: relative;
    }
    .box::before{
      content: ' ';
      display: block;
      width: 20px;
      height: 20px;
      border-radius: 50%;
      position: absolute;
      top: 0;
      left: 0;
      opacity: 0;
      background: #ed6c00;
      animation: guidePlay 3s linear infinite;
      animation-delay: 1s;
    }
    .box::after{
      content: ' ';
      display: block;
      width: 20px;
      height: 20px;
      border-radius: 50%;
      position: absolute;
      top: 0;
      left: 0;
      opacity: 0;
      background: #ed6c00;
      animation: guidePlay 3s linear infinite;
      animation-delay: 2s;
    }
    @keyframes guidePlay {
      0% {
        -webkit-transform: scale(0.1);
        transform: scale(0.1);
        opacity: 0;
      }
      10% {
        opacity: .8;
      }
      60% {
        opacity: 0.1;
      }
      to {
        -webkit-transform: scale(1.2);
        transform: scale(1.2);
        opacity: 0;
      }
    }
  </style>
</head>
<body>
  <div class="box"></div>
</body>
</html>

请求数据时使用的css动画

效果
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
  <style>
    * {
      padding: 0;
      margin: 0;
    }
    html, body{
      width: 100%;
      height: 100%;
    }
    .box {
      margin: 100px auto;
      width: 100px;
      height: 50px;
    }
    .dot{
      display: inline-block;
      height: 1em;
      line-height: 1;
      text-align: left;
      vertical-align: -.25em;
      overflow: hidden;
    }
    .dot:before {
      display: block;
      content: '...\A..\A.';
      white-space: pre-wrap;
      animation: dot 3s infinite step-start both;
    }
    @keyframes dot {
      33% { transform: translateY(-2em); }
      66% { transform: translateY(-1em); }
    }
  </style>
</head>
<body>
  <div class="box">
    加载中<i class="dot"></i>
  </div>
</body>
</html>

用css画一个心

效果:

image
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1.0">
    <title>ceshi</title>
    <style>
      .box{
        width: 100px;
        height: 100px;
        background: tomato;
        position: relative;
        top: 50px;
        left: 50px;
        transform: rotate(-45deg);
      }
      .box::before {
        content: ' ';
        position: absolute;
        top: -50px;
        left: 0;
        width: 100px;
        height: 100px;
        border-radius: 50%;
        background: tomato;
      }
      .box::after {
        content: ' ';
        position: absolute;
        top: 0;
        left: 50px;
        width: 100px;
        height: 100px;
        border-radius: 50%;
        background: tomato;
      }
    </style>
  </head>
  <body>
    <div class="box"></div>
  </body>
</html>
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 第一部分 HTML&CSS整理答案 1. 什么是HTML5? 答:HTML5是最新的HTML标准。 注意:讲述HT...
    kismetajun阅读 28,079评论 1 45
  • 今天我想讲一个故事,不是心灵鸡汤,是什么待会儿告诉你。 故事发生在05年左右,那时候国家还没现在这么富裕,即使是在...
    不不布衣阅读 1,911评论 0 0
  • 人间三月美, 百花齐相会。 梅兰樱桃众, 未到还剩谁?
    新星之静夜思阅读 3,188评论 1 6
  • 打开首饰盒,戒指亮出来的那一瞬,是多少人一生中最难忘的瞬间。 然而当你把戒指拿出来,开开心心戴上了,首饰盒这个见证...
    去东京_学建筑阅读 4,032评论 0 0
  • 当我们因某事困扰,感到问题对我们来说是那么的难以解决,那么的困难,那么的沉重,如一座山压在我们心里,让我们...
    Alice林阅读 2,383评论 0 0