Home > Article > Web Front-end > Animating CSS margin-left property
To animate the margin-left property in CSS, you can try running the following code
Live Demonstration
<!DOCTYPE html> <html> <head> <style> div { background-color: gray; animation: myanim 3s infinite; color: white; } @keyframes myanim { 30% { margin-left: 20px; } } </style> </head> <body> <h2>Heading One</h2> <div> This is demo text. </div> </body> </html>
The above is the detailed content of Animating CSS margin-left property. For more information, please follow other related articles on the PHP Chinese website!