xxxxxxxxxx
CSS
.container {
display: flex;
flex-wrap: wrap;
justify-content: space-around;
padding: 10px;
}
.box {
flex: 0 15%; /*lower the % to get more columns - raise % to get less*/
flex-grow: 1;
background-color: orange; /*change the color (just orange to show outline)*/
height: 500px;
width: 300px;
margin: 10px;
border: 2px solid black;
}
xxxxxxxxxx
.item {
width: 100%
}
.container {
display: flex;
flex-wrap: wrap;
}
.container > div {
flex: 50%; /* or - flex: 0 50% - or - flex-basis: 50% - */
/*demo*/
box-shadow: 0 0 0 1px black;
margin-bottom: 10px;
}
/////////////html
<div class="container">
<div class="item">1</div>
<div class="item">2</div>
<div class="item">3</div>
<div class="item">4</div>
</div>
xxxxxxxxxx
.container {
display: flex;
flex-wrap: wrap;
justify-content: space-around;
padding: 10px;
}
.box {
flex: 0 31%; /*lower the % to get more columns - raise % to get less*/
flex-grow: 1;
background-color: orange; /*change the color (just orange to show outline)*/
height: 500px;
width: 300px;
margin: 10px;
border: 2px solid black;
}
xxxxxxxxxx
.container {
display: flex;
flex-wrap: wrap;
justify-content: space-around;
padding: 10px;
}
.box {
flex: 0 47%; /*lower the % to get more columns*/
flex-grow: 1;
background-color: orange; /*change the color (just orange to show outline)*/
height: 500px;
width: 300px;
margin: 10px;
border: 2px solid black;
}
xxxxxxxxxx
.container {
display: flex;
flex-wrap: wrap;
justify-content: space-around;
padding: 10px;
}
.box {
flex: 0 13%; /*lower the % to get more columns - raise % to get less*/
flex-grow: 1;
background-color: orange; /*change the color (just orange to show outline)*/
height: 500px;
width: 300px;
margin: 10px;
border: 2px solid black;
}