I am working with a flexbox layout that currently looks like this:
https://i.stack.imgur.com/ULHEk.jpg
My main question now is whether there is a way to disrupt the flow externally from the flexbox, so that the blocked element can move to the next position, similar to this example:
https://i.stack.imgur.com/3CAb6.jpg
The flexbox I am dealing with is essentially a sorting container, meaning I cannot add anything inside other than the elements being sorted. Typically, the columns have equal heights, but occasionally I need the first column to be slightly shorter.
I have experimented with setting the boxes to flow: left
and display: inline-block
in various combinations, but so far, I have been unable to achieve the desired result.
.container {
width: 120px;
height: 180px;
margin: 40px 0 0 100px;
}
.flexbox {
display: flex;
flex-direction: column;
flex-wrap: wrap;
justify-content: flex-start;
width: 120px;
height: 180px;
background: pink;
}
.inbox {
width: 50px;
height: 50px;
margin: 5px;
background: purple;
color: #fff;
margin-left: auto;
}
.box {
float: left;
width: 110px;
height: 60px;
margin: -60px 0 0 -60px;
background: orange;
}
<div class="container">
<div class="flexbox">
<div class="inbox"> 1 </div>
<div class="inbox"> 2 </div>
<div class="inbox"> 3 </div>
<div class="inbox"> 4 </div>
<div class="inbox"> 5 </div>
</div>
<div class="box"></div>
</div>
Edit My focus is specifically on the bottom-left corner, so any creative solution would suffice.