Open sweeetcc opened 8 years ago
flex 属性是 flex-grow、flex-shrink 和 flex-basis 三个属性的简写。
none | [ <'flex-grow'> <'flex-shrink'>? || <'flex-basis'> ]
flex: none; 同: flex: 0 0 auto;
/* 单个值,不带单位,指的是 flex-grow */ flex: 1;
/* 单个值,带单位,指的是 flex-basis */ flex: 200px;
/* 两个值: flex-grow | flex-basis */ flex: 1 30px;
/* 两个值:flex-grow | flex-shrink */ flex: 1 1;
/* 三个值:flex-grow | flex-shrink | flex-basis */ flex: 2 2 10%;
flex-direction: row | row-reverse | column | column-reverse;
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: flex-start | flex-end | center | space-between | space-around | stretch;
说是总结,就是把所有属性都过了一遍,写 react native 感受颇深,需要用到 flex 的地方有时候概念并不清楚,好啦~ 现在清楚啦,以后多温习~
相关属性
一、 弹性元素属性
1. 占地面积相关:
flex 属性是 flex-grow、flex-shrink 和 flex-basis 三个属性的简写。
2. 其他属性:
二、弹性容器属性
1. 排列相关:
2. 对齐相关:
示例:
一、父元素属性
1. flex-direction:
2. flex-wrap:
3. flex-flow:
4. justify-content:
5. align-items:
6. align-content:
二、 子元素属性:
1. order:
2. flex-grow:
3. flex-shrink:
4. align-self: