首页
CSS
CSS Flexbox
Flex 项目
尝试:使用 align-self: flex-start 和 align-self: flex-end
运行 ❯
获取您的
自己
网站
×
更改方向
保存代码
更改主题,深色/浅色
前往 Spaces
<!DOCTYPE html> <html> <head> <style> .flex-container { display: flex; height: 200px; background-color: #f1f1f1; } .flex-container > div { background-color: DodgerBlue; color: white; width: 100px; margin: 10px; text-align: center; line-height: 75px; font-size: 30px; } </style> </head> <body> <h1>The align-self Property</h1> <p>The "align-self: flex-start;" aligns the selected flex item at the top of the container.</p> <p>The "align-self: flex-end;" aligns the selected flex item at the bottom of the container.</p> <div class="flex-container"> <div>1</div> <div style="align-self: flex-start">2</div> <div style="align-self: flex-end">3</div> <div>4</div> </div> <p>The align-self property overrides the align-items property of the container.</p> </body> </html>