grid布局(二)

知有的头像
知有
141

grid布局

gap(间距):

有column-gap和row-gap分别定义每列和没行的间距,gap属性就是它们的简写如:

column-gap:10px;row-gap:10px;就可以写为gap:10px;

grid-template-areas:

定义区域,如:

grid-template-areas:'a b c' 'd e f' 'g h i'就是将6个盒子,定义6个区域;

grid-template-areas:'a a a' 'b b b' 'c c c'就是将6个盒子,定义3个区域;

不需要的区域就用.表示。

arid-auto-flow:

设置子元素的排列顺序。当值为row时正常,column时就是竖着排列。

还有一个dense属性值,简单来说,它的作用如下图的演示。

无dense属性值

有dense属性值

用户评论
评论列表