首頁  >  文章  >  web前端  >  CSS flex-wrap 屬性

CSS flex-wrap 屬性

王林
王林轉載
2023-09-02 08:05:021352瀏覽

CSS flex-wrap 属性

使用 flex-wrap屬性來設定flex項目是否換行。

您可以嘗試執行以下程式碼來實作flex-wrap屬性。這裡的flex專案會換行

範例

即時示範

<!DOCTYPE html>
<html>
   <head>
      <style>
         .mycontainer {
            display: flex;
            background-color: orange;
            flex-wrap: wrap;
         }
         .mycontainer > div {
            background-color: white;
            text-align: center;
            line-height: 40px;
            font-size: 25px;
            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>Q5</div>
         <div>Q6</div>
         <div>Q7</div>
         <div>Q8</div>
         <div>Q9</div>
      </div>
   </body>
</html>

以上是CSS flex-wrap 屬性的詳細內容。更多資訊請關注PHP中文網其他相關文章!

陳述:
本文轉載於:tutorialspoint.com。如有侵權,請聯絡admin@php.cn刪除