Oliver Martin
Oliver Martin

Reputation: 99

Vertical alignment of items in a susy gallery()

How do I vertical-align: middle items in a susy gallery()? The image I have attached shows my items vertical alignment as it currently stands. As you can see from my highlighting they are all currently vertical-align: top.

enter image description here

Thank you in advance.

Oliver

Upvotes: 0

Views: 70

Answers (1)

Miriam Suzanne
Miriam Suzanne

Reputation: 14010

It's not possible using gallery(), because CSS doesn't have any way to vertically-center floats. To get a centered gallery, you should use flexbox, grid, display-table, or inline-block layouts. You can still use Susy to do the math, if it helps. Here it is with flexbox:

.container {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
}

.item {
  background: lightgray;
  flex-basis: span(1 of 6);
  margin-right: gutter(of 6);

  &:nth-child(6n) {
    margin-right: 0;
  }
}

Upvotes: 1

Related Questions