彈性盒子中的order

order

order 屬性 設置或檢索彈性盒模型對象的子元素出現的順序。。css

注意:若是元素不是彈性盒對象的元素,則 order 屬性不起做用。html

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Flexbox Demo</title>
  <style>
    .container1 {
      height: 500px;
      display: flex;
      border: 2px solid #ccc;
      justify-content: center;
      align-items: center;
      flex-wrap: wrap;
    }

    .item {
      width: 200px;
      height: 200px;
    }
  </style>
</head>
<body>
  <div class="container1">
    <div class="item" style="background-color: red;order: 1"></div>
    <div class="item" style="background-color: yellow;order: 1"></div>
    <div class="item" style="background-color: blue;order: -1"></div>
  </div>
</body>
</html>

詳解查看官方解釋css3

相關文章
相關標籤/搜索