Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use the animation-fill-mode attribute in css

2025-04-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces how to use the animation-fill-mode attribute in css. The article is very detailed and has certain reference value. Interested friends must read it!

CSS3animation-fill-mode property

Effects: The animation-fill-mode property specifies whether animation effects are visible before or after the animation is played.

Description: By default, CSS animations don't affect elements until the first keyframe is played, and stop affecting elements after the last keyframe is complete. The animation-fill-mode property overrides this behavior.

Grammar:

animation-fill-mode:none|forwards|backwards|both;

None: Does not change default behavior.

forwards: Keep the last attribute value (defined in the last keyframe) when the animation is complete.

backwards: Apply the start attribute value (defined in the first keyframe) before the animation is displayed for the period specified by animation-delay.

Both: Forward and backward fill modes are applied.

Note: Internet Explorer 9 and earlier versions do not support the animation-fill-mode attribute.

CSS3Animation-fill-mode attribute usage example

div

{

width:100px;

height:100px;

background:red;

position:relative;

animation:mymove3s;

animation-iteration-count:2;

animation-fill-mode:forwards;

Safari and Chrome*/

-webkit-animation:mymove3s;

-webkit-animation-iteration-count:2;

-webkit-animation-fill-mode:forwards;

}

@keyframesmymove

{

from{top:0px;}

to{top:200px;}

}

@-webkit-keyframesmove/*Safari and Chrome*/

{

from{top:0px;}

to{top:200px;}

}

The above is "how to use animation-fill-mode attribute in css" all the contents of this article, thank you for reading! Hope to share the content to help everyone, more relevant knowledge, welcome to pay attention to the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report