Home > Web Front-end > CSS Tutorial > Sets how many times the animation should run using CSS

Sets how many times the animation should run using CSS

王林
Release: 2023-08-28 10:53:17
forward
1274 people have browsed it

设置动画应使用 CSS 运行多少次

Use the animation-iteration-count property to set the number of times the animation should run using CSS.

The following example sets the animation count to 2:

Example

Live Demo

<!DOCTYPE html>
<html>
   <head>
      <style>
         div {
            width: 150px;
            height: 200px;
            background-color: yellow;
            animation-name: myanim;
            animation-duration: 2s;
            animation-iteration-count: 2;
         }
         @keyframes myanim {
         from {
            background-color: green;
         }
         to {
               background-color: blue;
            }
         }
      </style>
   </head>

   <body>
      <div> </div>
   </body>
</html>
Copy after login

The above is the detailed content of Sets how many times the animation should run using CSS. For more information, please follow other related articles on the PHP Chinese website!

source:tutorialspoint.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template