I have a div
containing three inner div
s.
ONE - I am div TWO - I am div THREE - I am div
When viewed on mobile, only two div
s can fit in a row horizontally. I want the third div
to move down.
Like this:
ONE - I am div TWO - I am div
THREE - I am div
How can I achieve this layout?
I am utilizing flex
.
Edit
I have included the HTML code snippet.
In my project using React and other UI components, I simplified it into something like this.
<div class="parent">
<div class="child">
<span>ONE</span>
<p>I am div</p>
</div>
<div class="child">
<p>TWO</p>
<p>I am div</p>
</div>
<div class="child">
<span>THREE</span>
<p>I am div</p>
</div>
<div>
.parent {
display: flex;
justify-content: space-around;
margin-bottom: 3rem;
white-space: nowrap;
}
.child {
display: flex;
align-items: center;
margin-left: 1rem;
margin-right: 1rem;
}