JSFiddle - React, Tailwind, and code Playground
HTML
<div class="container">
<div class="box blue">Blue</div>
<div class="box blue">Blue</div>
<div class="box orange">Orange</div>
<div class="box green">Green</div>
<div class="box green">Green</div>
<div class="box green">Green</div>
<div class="box red">Red</div>
<div class="box red">Red</div>
<div class="box red hide-reds">Red</div>
<div class="box red hide-reds">Red</div>
</div>
CSS
.container {
display: flex;
flex-wrap: wrap;
}
.box {
flex: 0 0 100%;
}
.red {
flex: 1 0 100%;
background: red;
height: 170px;
}
.hide-reds {
display: none;
}
@media all and (min-width: 800px) {
.red {
flex-basis: 40%; /* see note below */
display: block;
}
}
/* not relevant to the question */
.blue {
background: blue;
}
.orange {
background: Orange;
height: 300px;
}
.green {
background: green;
}
html {
font-size: 20px;
}
.box {
color: white;
font-size: 100px;
text-align: center;
text-shadow: 4px 4px 0 rgba(0, 0, 0, 0.1);
padding: 10px;
margin: 5px;
}