Flexbox-调整内容和最后一行/子级中间的内容空间

时间:2018-07-03 14:05:23

标签: css sass flexbox

我目前使用flexbox设置了网格。我需要使行与边缘对齐,但最终的子项必须居中。理想情况下,我希望将JS排除在公式之外,但是如果我找不到仅使用CSS的解决方案,则可能需要计算间距。孩子是图像(目前隐藏)。所附的图片是我当前的实现。

enter image description here

.video-picker {
  display: flex;
  flex-wrap: wrap;
  flex-flow: row wrap;
  justify-content: space-between;
  max-width:800px;
}

.video-picker__item {
  height: 100px;
  width: 20%;
  margin: 10px 0;
  height: 120px;
  border: 1px solid black;
  display: flex;
  justify-content: center;
}

.video-picker__item img {
  visibility: hidden;
  height: 100%;
}
<div class="video-picker">
  <div class="video-picker__item">
    <img src="img" />
  </div>
  <div class="video-picker__item">
    <img src="img" />
  </div>
  <div class="video-picker__item">
    <img src="img" />
  </div>
  <div class="video-picker__item">
    <img src="img" />
  </div>
  <div class="video-picker__item">
    <img src="img" />
  </div>
  <div class="video-picker__item">
    <img src="img" />
  </div>
  <div class="video-picker__item">
    <img src="img" />
  </div>
</div>

0 个答案:

没有答案