【发布时间】:2018-07-05 01:06:59
【问题描述】:
在下面的代码中,如果我注释掉 flex-column 中的align-items 行,背景是灰色的,图标之间有空格。如果我取消注释align-items,则背景为蓝色且图标居中。
我认为align-items 和justify-content 是相互正交的——为什么align-items 会影响子flexbox 容器中的flexbox 间距问题?宽度不是从 100% 开始的吗?
我认为它只会管理其直接子代。此外,当align-items 处于活动状态时,整个区域都是蓝色的,我至少不应该看到图标的背景是灰色的吗?
.flex-column {
display: flex;
flex-direction: column;
align-items: center;
background-color: blue;
}
.flex-row {
display: inline-flex;
flex-direction: row;
justify-content: space-between;
background-color: gray;
}
<div class="flex-column">
<div>Some Content0</div>
<div>Some Content1</div>
<div class="flex-row" style='border: solid;'>
<img src="update.svg" style="max-width: 20px;">
<img src="update.svg" style="max-width: 20px;">
</div>
<div>Some Content2</div>
<div>Some Content3</div>
</div>
【问题讨论】: