grid 布局
通过 display: grid 开启 grid-template-rows/gird-template-columns 用于自定义行列,值可以是:
- 同 width 一样的值,例如 100px, 30%
- auto-fill, 类似于 flex-grow 使容器填充元素至装不下再换行,行列都行
- 1fr, 类似于 flex: 1, 占剩余空间的多少份
- minmax (最小值,最大值), 限制长度的范围
- repeat (内容), 当多个值相同时,可使用 repeat 函数,
- 例如 grid-template-rows: 10px 20px 30px 10px 20px 30px = grid-template-columns: repeat (2, 10px 20px 30px);
grid-gap/grid-row-gap/grid-column-gap 用于定义行列的间隔