I'm trying to make these divs wrap under each-other and take up the white space. At the moment it's like they're in another row and want site under the above div.
Is this sort of thing possible with flexbox or do I need to use another method? Any help is appreciated.
Maybe I need to use floats instead? or CSS grid?
Codepen for reference
* {
margin: 0;
box-sizing: border-box;
}
.container {
max-width: 1000px;
background-color: grey;
}
.row {
margin: auto;
display: flex;
flex-wrap: wrap;
}
.content-wrapper {
width: 50%;
}
<div class="container">
<div class="row">
<div class="content-wrapper">
<h3>content 1</h3>
<ul>
<li>1</li>
<li>2</li>
<li>3</li>
<li>4</li>
<li>5</li>
<li>6</li>
</ul>
</div>
<div class="content-wrapper">
<h3>content 2</h3>
<ul>
<li>1</li>
<li>2</li>
</ul>
</div>
<div class="content-wrapper">
<h3>content 3</h3>
<ul>
<li>1</li>
<li>2</li>
<li>3</li>
<li>4</li>
<li>5</li>
</ul>
</div>
<div class="content-wrapper">
<h3>content 4 (remove whitespace above me)</h3>
<ul>
<li>1</li>
<li>2</li>
<li>3</li>
<li>4</li>
<li>5</li>
<li>6</li>
<li>7</li>
<li>8</li>
<li>9</li>
<li>10</li>
</ul>
</div>
<div class="content-wrapper">
<h3>content 5 (remove whitespace above me)</h3>
<ul>
<li>1</li>
<li>2</li>
<li>3</li>
<li>4</li>
<li>5</li>
</ul>
</div>
<div class="content-wrapper">
<h3>content 6</h3>
<ul>
<li>1</li>
<li>2</li>
</ul>
</div>
</div>
</div>