Flexbox之间的对齐内容空间不起作用

时间:2018-10-14 11:29:02

标签: html css twitter-bootstrap css3 flexbox

所以我要做的是使3 div垂直对齐,顶部为第1个,中间为第2个,底部为第3个。

我的HTML:

<div class="d-flex flex-column align-content-spacebetween" style="height:100%;">
  <div></div>
  <div></div>
  <div></div>
</div>

这为什么不起作用?他们在顶部的一个在另一个的下面。

1 个答案:

答案 0 :(得分:0)

由于您没有共享CSS代码,所以很难说,但这是使用flex的示例

.align-content-spacebetween{
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 100vh;
}

.align-content-spacebetween div{
  border: 1px solid black;
  text-align: center;
  height: 50px;
}
<div class="align-content-spacebetween">
  <div>1</div>
  <div>2</div>
  <div>3</div>
</div>