W3School TIY Editor
W3School 在线教程
改变方向
暗黑模式
运行代码
<!DOCTYPE html> <html> <head> <style> #main { width: 350px; height: 100px; border: 1px solid #c3c3c3; display: flex; } #main div:nth-of-type(1) {flex-grow: 1;} #main div:nth-of-type(2) {flex-grow: 1;} #main div:nth-of-type(3) {flex-grow: 1;} #myBlueDiv { animation: mymove 5s infinite; } @keyframes mymove { 50% {flex-grow: 8;} } </style> </head> <body> <h1>flex-grow 的动画效果:</h1> <p>Gradually change the flex-grow property of the "blue DIV" from 1 to 8, and back to 1:<p> <div id="main"> <div style="background-color:coral;"></div> <div style="background-color:lightblue;" id="myBlueDiv"></div> <div style="background-color:khaki;"></div> </div> <p><b>注释:</b>CSS 动画在 Internet Explorer 9 以及更早版本中不起作用。</p> </body> </html>