如何在列中对齐行flex元素?

时间:2016-09-18 07:45:14

标签: css flexbox

我使用flex来对齐我的元素。 #sentinels是最外面的容器,div的每一行(下例中为绿色)都有line类。

#sentinels {
    display: flex;
    flex-direction: column;
    justify-content: space-around;
}
.line {
    display: flex;
    flex-direction: row;
    justify-content: space-around;
}

这给出了

enter image description here

但是,我希望div在列中对齐:

enter image description here

flex是否可以进行此类设置?

1 个答案:

答案 0 :(得分:1)

看看这个https://jsbin.com/jevaqovaga/edit?html,css,output。每个内部div的宽度为100%的外部div可以解决您的问题。

相关问题