I have a row of 6 items positioned by flex.
1 2 3 4 5 6
But under e.g. 600px
I would like to cut them in half and move to another row.
1 2 3
4 5 6
I could use flex-wrap: wrap
but it is wrapping one element per specified screen width.
Thanks for help.
PS. I Dont want to use display: none
and duplicate elements.
.wrapper {
display: flex;
}
.b {
margin: 12px;
width: 100px;
height: 60px;
background: blue;
color: white;
display: flex;
align-items: center;
justify-content: center;
font-size: 17px;
}
@media screen and (max-width: 600px) {
.wrapper {
flex-wrap: wrap;
}
}
<div class="wrapper">
<div class='b'>1</div>
<div class='b'>2</div>
<div class='b'>3</div>
<div class='b'>4</div>
<div class='b'>5</div>
<div class='b'>6</div>
</div>