I am currently working on a website project, and I am looking to display text content in two columns using flexbox with each column taking up 50% of the width. However, I am encountering an issue as illustrated in the image below:
https://i.sstatic.net/Gha0i.png
Instead of leaving the third div empty and disrupting the layout of the page, I want it to fill the space below the second div.
Below is a sample code snippet that showcases the problem:
#container {
display: flex;
flex-wrap: wrap;
}
.d {
box-sizing: border-box;
font-size: 24px;
width: 50%;
padding: 25px;
text-align: justify;
}
<div id="container">
<div class="d" id="d1">
<!-- Content for div d1 -->
</div>
<div class="d" id="d2">
<!-- Content for div d2 -->
</div>
<div class="d" id="d3">
<!-- Content for div d3 -->
</div>
<div class="d" id="d4">
<!-- Content for div d4 -->
</div>
</div>
If you prefer, here is a CodePen link: link