CSS justify-content 屬性取值 flex-end 的作用


使用取值為flex-endjustify-content 屬性,可將 flex-item 對齊到末尾。

示例

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

即時演示

<!DOCTYPE html>
<html>
   <head>
      <style>
         .mycontainer {
            display: flex;
            background-color: red;
            justify-content: 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 年 7 月 3 日

103 次瀏覽

啟動你的職業

透過完成課程來獲得認證

開始
廣告
© . All rights reserved.