我正在尝试将我的 Flexbox 布局更改为新的display: grid
,并且默认情况下,列从左侧开始。
如何让它们从中心开始而不指定grid-column-start
这样的?
(就像align-items: center
Flexbox 中的一样)
有可能display: grid
吗?
编辑:这是我的 HTML 结构和 CSS 样式。
HTML
<div class="centered grid">
<div class="three wide column"></div>
<div class="two wide column"></div>
</div>
SASS
.grid
display : grid
grid-template-columns: repeat(12, 1fr)
.grid .column[class*="two wide"]
grid-column: span 2
.grid .column[class*="three wide"]
grid-column: span 3
而且我还尝试将 应用于justify-self: center
我想要居中的列,但结果不是我所期望的。(列不是从网格的中心开始的。)