欢迎来到DIVCSS5查找CSS资料与学习DIV CSS布局技术!

弹性盒子中的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>

如需转载,请注明文章出处和来源网址:http://www.divcss5.com/html/h58050.shtml