Home > Web Front-end > CSS Tutorial > Set whether the animation plays forward or use CSS

Set whether the animation plays forward or use CSS

WBOY
Release: 2023-09-20 18:53:02
forward
698 people have browsed it

设置动画是向前播放还是使用 CSS

Use the animation-direction property to set whether the animation plays forward, backward, or alternately loops:

Example

Real-time demonstration

<!DOCTYPE html>
<html>
   <head>
      <style>
         div {
            width: 150px;
            height: 200px;
            background-color: yellow;
            animation-name: myanim;
            animation-duration: 2s;
            animation-direction: reverse;
         }
         @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 Set whether the animation plays forward or use 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