Is there a way to use flexbox to ensure that the 2.5
element is placed below the 2
element instead of beside it on the same row within the flex container?
Given the HTML provided, how can I achieve this layout using flexbox?
I attempted to accomplish this with CSS Grid for IE compatibility but encountered issues due to partial support. Now, I am exploring options to make it work specifically for IE.
Codepen: https://codepen.io/anon/pen/ewqmXw
.flex-container {
display: flex;
}
.item-1 {
order:1;
background-color: rgba(200,520,266,.75);
border-color: #b4b4b4;
width: 50px;
}
.item-2 {
order:2;
background-color: rgba(145,223,0,.75);
border-color: transparent;
width: 50px;
}
.item-3 {
order:3;
background-color: rgba(145,520,0,.75);
width: 50px;
}
.item-4 {
order:4;
background-color: rgba(0,0,0,.25);
border-color: transparent;
width: 50px;
}
.item2half {
order:2;
background-color: rgb(20,100,255);
border-color: transparent;
width: 50px;
}
<div class="flex-container">
<div class="item-1">1</div>
<div class="item-2">2</div>
<div class="item2half">2.5</div>
<div class="item-3">3</div>
<div class="item-4">4</div>
</div>