I have two divs that are inside a flexbox. When there is enough space horizontally for them to fit on the same line, they look like this:
When I use the css property
flex-wrap: wrap
, the two divs will appear on different lines while floating left:
I want the green one to align to the right side but exist on a separate line as the blue one when the wrapping occurs in flexbox. It would look like this:
How do I do this with flexbox?
Here is the code:
.flexbox {
display: flex;
justify-content: space-between;
flex-wrap: wrap;
}
.blue {
min-height: 50px;
min-width: 300px;
background-color: blue;
}
.green {
min-height: 50px;
min-width: 300px;
background-color: green;
}
<div class="flexbox">
<div class="blue"></div>
<div class="green"></div>
</div>