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