目录

Flash

描述 (Description)

一阵元素的突然短暂爆发。

语法 (Syntax)

@keyframes flash {
   0%, 50%, 100% {
      opacity: 1;
   }
   25%, 75% {
      opacity: 0;
   }
}

参数 (Parameter)

  • Opacity - 不透明度适用于要进行半透明的元素。

例子 (Example)

<html>
   <head>
      <style>
         .animated {
            background-image: url(/css/images/logo.png);
            background-repeat: no-repeat;
            background-position: left top;
            padding-top:95px;
            margin-bottom:60px;
            -webkit-animation-duration: 1s;
            animation-duration: 1s;
            -webkit-animation-fill-mode: both;
            animation-fill-mode: both;
         }
         @keyframes flash {
            0%, 50%, 100% {
               opacity: 1;
            }
            25%, 75% {
               opacity: 0;
            }
         }
         .flash {
            animation-name: flash;
         }
      </style>
   </head>
   <body>
      <div id = "animated-example" class = "animated flash"></div>
      <button onclick = "myFunction()">Reload page</button>
      <script>
         function myFunction() {
            location.reload();
         }
      </script>
   </body>
</html>

它会产生以下结果 -

新页面打开
↑回到顶部↑
WIKI教程 @2018