1

Having a flexbox container which represents a grid of 3 columns and using the property of justify-content: space-around, how do we deal on last elements or first elements which would represent just 2 or 1 boxes/box to be aligned to the left side?

Here is an example to reproduce my issue:

.flex-container {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -ms-flex-wrap: wrap;
      flex-wrap: wrap;
  -ms-flex-pack: distribute;
      justify-content: space-around;
}
.flex-container .flex-box {
  display: block;
  height: 250px;
  max-width: 360px;
  -ms-flex-preferred-size: 360px;
      flex-basis: 360px;
  background-color: red;
  padding: 15px;
  margin-bottom: 30px;
}
<div class="flex-container">
 <div class="flex-box"></div>
 <div class="flex-box"></div>
 <div class="flex-box"></div>
 <div class="flex-box"></div>
 <div class="flex-box"></div>
 <div class="flex-box"></div>
 <div class="flex-box"></div>
</div>
Michael Benjamin
  • 307,417
  • 93
  • 525
  • 644
fefe
  • 8,467
  • 22
  • 90
  • 168

0 Answers0