Home >Web Front-end >CSS Tutorial >Set whether the animation plays forward or use CSS
Use the animation-direction property to set whether the animation plays forward, backward, or alternately loops:
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>
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!