1

Im looking for a way to make the elements in the last row of the flexed items the same with as the ones in a full row - without using JS. Flexbox seems to be promising for a solution, but the problem is, that the items in the last row will be wider if there is extra space. Is there a better way to do this?

.flex-container {
  display: flex;
  align-items: stretch;
  flex-wrap: wrap;
  background-color: #f1f1f1;
}

.flex-container > div {
  background-color: DodgerBlue;
  color: white;
  min-width: 100px;
  max-width: 200px;
  margin: 10px;
  text-align: center;
  line-height: 75px;
  font-size: 30px;
  flex-grow: 1;
}
<!DOCTYPE html>
<html>
<body>
<div class="flex-container">
  <div>item</div><div>item</div><div>item</div><div>item</div><div>item</div><div>item</div><div>item</div><div>item</div><div>item</div><div>item</div><div>item</div><div>item</div><div>item</div>
</div>
</body>
</html>
Anton Ballmaier
  • 876
  • 9
  • 25

0 Answers0