简体   繁体   中英

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 .

在此处输入图片说明

Thank you in advance.

Oliver

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;
  }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM