布局格式
1 | <div class="box"> |
1 | //Webkit 内核的浏览器,必须加上-webkit前缀。 |
- 设为 Flex 布局以后,子元素的float、clear和vertical-align属性将失效。
效果
1
2
3
4
5
6
7
8
9
box 容器属性
点击属性值,查看效果 [清空样式]
flex-direction:
row | row-reverse | column | column-reverse;flex-wrap:
nowrap | wrap | wrap-reverseflex-flow: [<flex-direction> || <flex-wrap>]
(默认值:row nowrap)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;
item 项目属性
- order : 定义项目的排列顺序。数值越小,排列越靠前,默认为0。
- flex-grow : 定义项目的放大比例,默认为0,即如果存在剩余空间,也不放大。
- flex-shrink : 定义了项目的缩小比例,默认为1,即如果空间不足,该项目将缩小。
- flex-basis
- flex : none | [ <flex-grow> <flex-shrink> || <flex-basis> ]
快捷设置 : auto (1 1 auto) 和 none (0 0 auto)
- align-self : 允许单个项目有与其他项目不一样的对齐方式