CSS align-items 屬性 flex-end 取值用法


使用 align-items 屬性的值flex-end將 flex 項對齊到底部。

你可以嘗試執行以下程式碼以實現flex-end

示例

線上演示

<!DOCTYPE html>
<html>
   <head>
      <style>
         .mycontainer {
            display: flex;
            height: 300px;
            background-color: red;
            align-items: flex-end;
         }
         .mycontainer > div {
            background-color: orange;
            text-align: center;
            line-height: 60px;
            font-size: 30px;
            width: 100px;
            margin: 5px;
         }
      </style>
   </head>
   <body>
      <h1>Quiz</h1>
      <div class = "mycontainer">
         <div>Q1</div>
         <div>Q2</div>
         <div>Q3</div>
         <div>Q4</div>
      </div>
   </body>
</html>

更新日期: 2020-06-24

106 次瀏覽

開啟你的 職業生涯

完成課程並獲得認證

立即開始
廣告
© . All rights reserved.