I have two divs in a flex space-between container and I want them to split in two lines above each other when they overflow
.container {
background: wheat;
padding: 10px;
width: 300px;
display: flex;
justify-content: space-between;
}
<div class="container">
<div>Lorem ipsum dolor sit amet 1</div>
<div>Lorem ipsum dolor sit amet 2</div>
</div>
2
Answers
You should add some lines code css
By "overflow", do you mean when the text wraps onto multiple lines? If so, you will need to add
white-space: nowrap;
in addition toflex-wrap: wrap;
.(But be careful with this approach unless you are very sure of the content requirements—if one of the texts is ever longer than the container div, it will just break out of the box.)