flex布局

2020-03-21  本文已影响0人  石显军

基础

常用css属性

flex 布局模型

image.png

flex-direction

row
row-reverse
columu
columu-reverse

justify-content

justify-content 决定了flex items 在 main axis 上的对齐方式
- flex-start(默认值) : 与main start对齐
- flex-end : 与main end 对齐
- center : 居中对齐
- space-betueen:
1. flex items 之间的距离相等
2. 与main start、main end 两端对齐
- space-evenly:
1. flex items 之间距离相等
2. flex items 与main start、main end 之间的距离 等于 flex items 之间的距离
- space-around:
1. flex items 之间距离相等
2. flex items 与main start、main end 之间的距离 等于 flex items 之间距离的一半

image.png

align-items

align-items决定了flex items 在 cross axis 上的对齐方式

flex-wrap

flex-wrap决定了flex container 是单行还是多行

flex-flow

flex-flowflex-direction ||flex-wrap 的简写

// flex-flow: column wrap 等价于

flex-direction:column;
flex-wrap:wrap;

align-content

align-content 决定了多行 flex items 在 cross axis 上的对齐方式,用法与justfiy-content类似

image.png

order

order决定了 flex items 的排布顺序

align-self

flex items 可以通过align-self覆盖flex-container设置align-items

flex-grow

flex-grow 决定了flex items 如何扩展

flex-shrink

flex-shrink 决定了flex items 如何收缩

flex-basis

flex-basis 用来设置flex items 在 main axis 方向上 base size

flex

flex 是 flex-grow flex-shrink? || flex basis 的简写

上一篇 下一篇

猜你喜欢

热点阅读