1

Having some troubles getting a layout correctly responsive using Flexbox.

Imagine a page only containing some panels. The goal is to show an x-amount of panels / row, aligned horizontal & vertical as the other ones.

The problem I am currently facing is the alignment when a panel switches from row. Trying to align a panel straight underneath the above one, but this is not working out at all.

My results so far:

Desktop

enter image description here

Tablet (here you'll see the problem in alignment (I should be right underneath the top left one...))

enter image description here

Phone

enter image description here

Code (simplified)

<div class="container">
 <div class="item"></div>
 <div class="item"></div>
 <div class="item"></div>
</div>

-

.container {
  display: flex;
  flex-flow: row wrap;
  max-width: 960px;
  justify-content: space-around;

  .item {
    margin-top: 24px;
    width: 264px;
    height: 183px;
    background: red;
  }
}
halfer
  • 19,824
  • 17
  • 99
  • 186
Jim Vercoelen
  • 1,048
  • 2
  • 14
  • 40

1 Answers1

4

try justify-content: space-between; instead of space-around for .container

Johannes
  • 64,305
  • 18
  • 73
  • 130