Quantcast
Channel: Active questions tagged flexbox - Stack Overflow
Viewing all articles
Browse latest Browse all 1320

Setting vertical gaps between flex items

$
0
0

If this is our code, it creates 4 boxes in each row, with an equal vertical space between them , but there are two problems that I don't know how to fix:

  1. Boxes in the last row should be adjusted to the left.

  2. There should be 20px vertical space between boxes.

How can I do that with flexbox?

.wrapper {  max-width: 80%;  margin: 20px auto 0;  display: flex;  flex-flow: wrap;  justify-content: space-between;  /* justify-content: flex-start; */}.box {  flex-basis: 23%;  height: 100px;  outline: 1px solid black;  background-color: #ccc;  margin-bottom: 20px;}
<div class="wrapper"><div class="box"></div><div class="box"></div><div class="box"></div><div class="box"></div><div class="box"></div><div class="box"></div><div class="box"></div><div class="box"></div><div class="box"></div><div class="box"></div><div class="box"></div></div>

Viewing all articles
Browse latest Browse all 1320

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>