CSS align-content 屬性 flex-start 值的使用方法


使用取值flex-startalign-content屬性將 flex 佈局中的多條線設定在頂部。

示例

你可以嘗試執行以下程式碼以實現flex-start值 −

實際演示

<!DOCTYPE html>
<html>
   <head>
      <style>
         .mycontainer {
            display: flex;
            height: 200px;
            background-color: blue;
            align-content: flex-start;
            flex-wrap: wrap;
         }
         .mycontainer > div {
            background-color: orange;
            text-align: center;
            line-height: 60px;
            font-size: 30px;
            width: 100px;
            margin: 5px;
         }
      </style>
   </head>
   <body>
      <h1>Queue</h1>
      <div class = "mycontainer">
         <div>Q1</div>
         <div>Q2</div>
         <div>Q3</div>
         <div>Q4</div>
         <div>Q5</div>
         <div>Q6</div>
         <div>Q7</div>
         <div>Q8</div>
      </div>
   </body>
</html>

更新日期:2020 年 7 月 4 日

106 次瀏覽

開啟您的職業生涯

透過完成本課程獲取認證

開始學習
廣告