【发布时间】:2019-01-15 01:13:06
【问题描述】:
我正在使用 flex 属性创建 div。每行有三个网格。第一个和第三个网格应分别对齐左侧和右侧。但是中心网格应该对齐中心。我试过但没有用。另外我在上面附上了我的代码。
.outer {
display: flex;
flex-direction: row;
flex-wrap: nowrap;
justify-content: space-between;
align-items: center;
align-content: space-between;
}
.outer-grid {
max-width: 150px;
padding: 20px;
background: #ff4040;
color: #fff;
}
<div class="outer">
<div class="outer-grid"> One </div>
<div class="outer-grid"> two </div>
<div class="outer-grid"> three </div>
<div class="outer-grid"> four </div>
<div class="outer-grid"> five </div>
<div class="outer-grid"> six </div>
</div>
【问题讨论】:
-
你有 6 个盒子,而不是 3 个。
-
不..应该是这样,但布局应该是我说的。这可能吗?
标签: html css flexbox centering