要使用CSS在height 属性上实现动画,您可以尝试运行以下代码
<!DOCTYPE html> <html> <head> <style> div { border: 2px solid black; width: 300px; height: 100px; animation: myanim 5s infinite; } @keyframes myanim { 30% { height: 400px; } } </style> </head> <body> <div>This is demo text</div> </body> </html>