首页 > 文章列表 > css中order属性的介绍

css中order属性的介绍

css order
128 2022-08-06

1、order可以改变一个flex子项的排序位置。

2、order属性用于提供有关弹性容器中其他弹性项目的每个弹性项目的顺序。 如果商品不灵活,那么order属性将毫无用处。

实例

<style type="text/css">
.box{width: 100px;height: 100px;}
.div{display: flex;}
.bg0{background: #111;}.bg1{background: #444;}.bg2{background: #777;}.bg3{background: #999;}  
.o1{order:-1;}.o2{order:0;}.o3{order:1;}.o4{order:2;}
</style>
<div>
<div class="box bg0">1</div>
<div class="box bg1">2</div>
<div class="box bg2">3</div>
<div class="box bg3">4</div>
</div>
<div class="div po" >
<div class="box bg0 o4">1</div>
<div class="box bg1 o2">2</div>
<div class="box bg2 o3">3</div>
<div class="box bg3 o1">4</div>
</div>

本文教程操作环境:windows7系统、css3版,DELL G3电脑。