How can I make the .right-content
stack under the div above it?
I'm using flex
and flex-basis
to make this layout and what I realized is If the left-content
is too long, the second div .right-content
(social icons) will gets pushed down and wont stack under the first div holding same class. Tried to make the code as short as I can.
Or check the code below:
div {
border: 1px solid
}
.wrap {
margin: 0 auto;
max-width: 800px;
overflow: hidden;
}
.content {
display: flex;
flex-flow: row wrap;
margin-left: auto;
margin-right: auto;
align-items: flex-start;
width: 100%;
}
.left-content {
flex-basis: 65%;
}
.right-content {
flex-basis: 33%;
margin-left: auto;
margin-right: 0;
}
<div class="wrap">
<div class="wrap__main">
<div class="content">
<div class="left-content">
<div class="content">
<h2>This is header</h2>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. </p>
</div>
<div class="content">
<h2>This is header</h2>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. </p>
</div>
</div>
<div class="right-content">
<form>
<input type="text" placeholder="Name">
<input type="text" placeholder="email">
<input type="submit" value="Submit">
</form>
</div>
<div class="left-content">
<div class="content">
<h2>This is header</h2>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. </p>
</div>
</div>
<div class="right-content">
<a href="http://www.facebook.com/"><img src="http://via.placeholder.com/22/f5f" width="22" alt="Facebook" /></a>
<a href="http://www.facebook.com/"><img src="http://via.placeholder.com/22/f5f" width="22" alt="Facebook" /></a>
<a href="http://www.facebook.com/"><img src="http://via.placeholder.com/22/f5f" width="22" alt="Facebook" /></a>
</div>
</div>
</div>
</div>