- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to set the fill-mode for an Animation with CSS
To set the fill-mode for an animation with CSS, use the animation-fill-mode property. It has the values forwards, backward, both for both the directions, etc.
You can try to run the following code to set the fill-mode for animation;
Example
<!DOCTYPE html> <html> <head> <style> div { width: 150px; height: 200px; position: relative; background: red; animation-name: myanim; animation-duration: 2s; animation-fill-mode: forwards; } @keyframes myanim { from {left: 0px; background-color: green;} to {left: 200px; background-color: blue;} } </style> </head> <body> <div></div> </body> </html>
- Related Articles
- CSS animation-fill-mode property
- Set a delay for the start of an animation with CSS
- Set how many times an Animation should run with CSS
- Set an animation with the same speed from start to end with CSS
- How to delay an animation with CSS
- Shorthand property to set all the animation properties with CSS
- Set an animation with a slow start and end using CSS
- Set animation with a slow start using CSS
- Set animation with a slow end using CSS
- Set an animation with a slow start, then fast, and end slowly with CSS
- Set how long an animation should take to complete one cycle using CSS
- How to Create Typewriter Animation with CSS?
- Set the name of the CSS @keyframes animation
- Set a CSS style for the element when the animation is not playing
- Set the number of times an animation should be played using CSS

Advertisements