![](/img/trans.png)
[英]Align items with different heights in a grid and have them match lines of alignment
[英]Cannot manage to have heights relative to items contents with css grid
目前,當我使用網格創建 css 布局時,此布局中的項目將占據最高項目的高度。 是否可以使項目僅采用其內容所需的高度?
https://codepen.io/anon/pen/NQpQOr
在此示例中,我希望div2
具有相對於其內容的高度。
您可以使用align-self
屬性來修復它:
.div-2 {
align-self: start;
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.