弹性盒子中的order

order

order 属性 设置或检索弹性盒模型对象的子元素出现的順序。。

注意:如果元素不是弹性盒对象的元素,则 order 属性不起作用。

<!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>

详解查看官方解释

猜你喜欢

转载自www.cnblogs.com/ygjzs/p/12043915.html