代码 | grid |
---|---|
grid-template-columns: 1fr 1fr 1fr; | grid列 |
grid-template-rows: 200px; | grid行 |
row-gap: 20px; | 行间距 |
column-gap: 20px; | 列间距 |
gap: 20px; | 间距 |
grid-row: 2/4; | 合并行 |
grid-column: 1/3; | 合并列 |
代码 | 弹性盒子 |
---|---|
display: flex; | 弹性盒子 |
flex-direction: row-reverse; | 改变主轴方向 |
justify-content: center; | 主轴排列方式 |
justify-content: space-between; | 两边贴边,中间平分剩余空间 |
justify-content: space-around; | 平分剩下空间 |
align-items: center; | 交叉轴的对齐方式 |
flex-wrap: wrap; | 自动换行 |
flex-grow: 1; | 分配剩余空间的相对比例 |
order: -2; | order值越小,排列越靠前 |
flex-shrink: 0; | 指定了 flex 元素的收缩规则 |
flex:1; | 与所有 CSS 尺寸相同,单位与数字间无空格 |