Home  >  Article  >  Web Front-end  >  Set shorthand properties for all animated properties using CSS

Set shorthand properties for all animated properties using CSS

WBOY
WBOYforward
2023-09-18 09:49:021154browse

使用 CSS 设置所有动画属性的简写属性

The shorthand property for setting all animation properties is animation. It sets the animation duration, animation name, etc.

You can try running the following code to use the animated shorthand attribute:

Example

Live Demo

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

The above is the detailed content of Set shorthand properties for all animated properties using CSS. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete