Chapter of order
property in CSS flexbox says:
Absolutely-positioned children of a flex container do not participate in flex layout, but are reordered together with any flex item children.
I thought order
on absolutely-positioned children of a flex container would place one on another and I tried as following:
.container {display: flex}
.child1, .child2 {position: absolute}
.child1 {background: red}
.child2 {background: yellow}
<div class="container">
<div class="child1">this is a first</div>
<div class="child2">this is an second</div>
</div>
I changed the order
of the two children:
.container {display: flex}
.child1, .child2 {position: absolute}
.child1 {background: red; order: 2;}
.child2 {background: yellow; order: 1;}
<div class="container">
<div class="child1">this is a first</div>
<div class="child2">this is an second</div>
</div>
and I didn't see the first lap over the second. I wonder what does order mean to absolutely-positioned children?
position: absolute
. Try adding some non-position: absolute; children to the flex container to see an effect. – Festooneryposition: relative;
, for whatever reason, you'll need to resort to az-index
solution as @Festoonery has commented. – Kacerek