I have 10 divs: 2 hidden and 8 stacked one on top of each other.
Using a media query, when resizing the screen, I can display the 2 hidden divs.
So, now I have 4 red divs at the bottom but I want them to appear in pairs - 2 lines with 2 red divs one next to each other.
How do I do that?
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;
/* width: calc(33.33% - 10px);*/
}
/* Flexbox code starts here */
.container {
display: flex;
/*Must!!!! on the container, in order to turn it to flex*/
flex-direction: column;
flex-wrap: wrap;
justify-content: center;
}
/* Colors for each box */
.blue {
background: blue;
}
.orange {
background: Orange;
height: 300px;
}
.green {
background: green;
}
.red {
background: red;
height: 170px;
}
.hide-reds {
display: none;
}
/*Media Queries for Different Screen Sizes*/
@media all and (min-width: 800px) {
.red {
display: block;
}
}
<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>