css 弹性布局

409 阅读1分钟

弹性布局主要属性

flex-direction 主轴的方向

flex:direction:row 横向

flex:direction:row-reverse横向反向

flex:direction:column 纵向

flex:direction:column-reverse 纵向反向

flex-wrap 如何换行

nowrap 不换行

wrap 换行

wrap-reserve 换行 从下往上排列

flex-flow 复合属性是flex-direction和flex-wrap的简写形式

justify-content 在主轴上的对齐方式

flex-start (默认)左对齐

flex-end 右对齐

center 居中

space-between 两段对齐

space-around 居中且项目之间的距离为项目到边框的距离的两倍

align-items 在交叉轴上的对齐方式

flex-start 上对齐

flex-end 下对齐

center 居中

baseline 第一行文字对齐

stretch 如果没有高度则拉伸(默认)

align-content 定义多根轴线对齐方式