Use the animation-iteration-count property to set the number of times the animation should run using CSS.
The following example sets the animation count to 2:
Live Demo
<!DOCTYPE html> <html> <head> <style> div { width: 150px; height: 200px; background-color: yellow; animation-name: myanim; animation-duration: 2s; animation-iteration-count: 2; } @keyframes myanim { from { background-color: green; } to { background-color: blue; } } </style> </head> <body> <div> </div> </body> </html>
The above is the detailed content of Sets how many times the animation should run using CSS. For more information, please follow other related articles on the PHP Chinese website!