运行 ❯
获取您
自己的
网站
×
更改方向
保存代码
更改主题,深色/浅色
前往 Spaces
<!DOCTYPE html> <html> <head> <style> #main { width: 300px; height: 100px; border: 1px solid #c3c3c3; display: flex; } #main div { flex-grow: 0; flex-shrink: 0; flex-basis: 50px; } #main div:nth-of-type(2) { flex-basis: 100px; } </style> </head> <body> <h1>The flex-basis Property</h1> <p>Set the initial length of the flex items to 50 pixels, with an exception; set the initial length of the second flex item to 100 pixels:</p> <div id="main"> <div style="background-color:coral;">50px</div> <div style="background-color:lightblue;">100px</div> <div style="background-color:khaki;">50px</div> <div style="background-color:pink;">50px</div> <div style="background-color:lightgrey;">50px</div> </div> </body> </html>