运行 ❯
获取您
自己的
网站
×
更改方向
保存代码
更改主题,暗/亮
前往 Spaces
<!DOCTYPE html> <html> <head> <style> body { background-color:#E7E9EB; } #main { background-color:#FFFFFF; width: 100%; height: 300px; display: flex; align-items: center; } #main div { flex: 1; } #myBlueDiv { align-self: flex-start; } </style> </head> <body> <h1>The align-self Property</h1> <div id="main"> <div style="background-color:coral;">This DIV has little content.</div> <div id="myBlueDiv" style="background-color:lightblue;">This DIV has more content and usually this can be a problem when aligning multiple DIV elements.</div> <div style="background-color:lightgreen;">This <br>DIV<br>has<br>many<br>line<br>breaks.</div> </div> </body> </html>