# 一、Flex 布局是什么?
Flex 是 Flexible Box 的缩写,意为"弹性布局",用来为盒状模型提供最大的灵活性。
任何一个容器都可以指定为 Flex 布局。
```
.box{
display: flex;
}
```
###### 行内元素也可以使用 Flex 布局。
```
.box{
display: inline-flex;
}
```
###### Webkit 内核的浏览器,必须加上-webkit前缀。
```
.box{
display: -webkit-flex; /* Safari */
display: flex;
}
```
##### 注意,设为 Flex 布局以后,子元素的float、clear和vertical-align属性将失效。
# 二、基本概念
采用 Flex 布局的元素,称为 Flex 容器(flex container),简称"容器"。它的所有子元素自动成为容器成员,称为 Flex 项目(flex item),简称"项目"。
![image][tmp]
[tmp]:data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAjMAAAFNCAMAAADCTB7cAAAC8VBMVEX568fN6f746cX7+/v9/f309PTx8fFaV0705sPs37zj1rXw4r9qaGX4+Pjl5eXc3Nzp6enW1taZmZmEhITFxcWwsLDVyarGu57o27mGkprbz6/NwaPy5MFmZ2OdlH2Gf2uyqI7g1LPf39/r6+vn5+e1tbXIyMifn5/Z2dmurq6clIGIiIjfTG/q3bvgXnD26MTTx6nu4L6swdG0qo9naWeKgm7Xy6zPxKfl2LfEuZzAtZnK5fteXl+so4qon4pgXlefln+60uWIi4iXjnj45MPZza5xdnibknzRxqeXlouBemewpo2FfmrwuKjxu6v55sTgYXLjbXnhZXXzx7H338D34cHup5/gU3P0zLXoiIqVo67N5/zJ5Pnywa6lt8XpkpDfUHHql5PhY3T22770yrO4z+DvrqLuq6HiaXf117vn2rjkcXz10LjrnJZjZGXzw6/top/pjo733b/xvq3bh5rsoJn22r3xtKjldn7gX3HleoHsnJvmfoT1z7bIvJ/akKK+1uj11brwsKXgVXXohY94foPhWXfXlbLrkpZgYWH107nd0bGToKrto5vO5PrP3PKcq7jkan9zeH1pbG722LzWoLzngofiXnmxxtbkY3zQ0ujlcIPfanznhojmdoZuc3bvs6S3rpbqjZOpopGblojQ1+zSyd7slpi7sZeMiH6UkITu7u7ne4nP4Pa0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DVCJ83Cef4A3A1xPuMcHbxPoPNoPWwGWkM8L+dwtl/C1yFUt30ZqVo5ud74Gcc+MHBQfgKRLSmmWo5mhnzbOYzyYUgpFUzD0rXzAD4GfgsGV/QL2yXtpmX4dE28HPImgnEXE1Q77Nm9GIz04mVbIHcdvzAJ0PgZj8g5BjExJqhsd6sXWmG/gKp7ZFc+BB4eeMT/16+UO9mDS9K1jSjzf89ApmNSc4fAjffySGI6YQ1k86tjUIzqqJ1zWcgM/7NfPKPQEhPvVOz3cqsyexyM5VaU4//Phf2Gdot7JBzHH/iNvkBImq8+BMlttPVlGm10MyGlaVft55IvJ/GhN3UhL3EctM48d5Fbo+tpqairpphKlOlo8dp/7fneXVZLRaLOroz7zQyE+oY2qRWudxMVWWDxohpOzGjaPMxQkub/ch0e7SVsTEzLTbDBk2TRZPavcR1TYSWXDfp2dTJ9M5yzKyaYdHUWDTduZNSattthHJ227Zp2ooNi20m9VozKotG0/9ncew4LYQuOE48N3SLTZl8MxWayaOZKZOOZul610DorJ06uAEQBIIomhhYbiA1CAd6pwBasRuXZDMYD3r0Mi+ZDn7GtLYfqZYwXwbNrGjckNBLrokIai49yEAysxnwWk0cIoHoRuQczopBM+A1GxWJwClvxaCZB0+0bHMGzRB9YDPEZugdm6HfXVQ5x+wf7lUyAAAAAElFTkSuQmCC
容器默认存在两根轴:水平的主轴(main axis)和垂直的交叉轴(cross axis)。主轴的开始位置(与边框的交叉点)叫做main start,结束位置叫做main end;交叉轴的开始位置叫做cross start,结束位置叫做cross end。
项目默认沿主轴排列。单个项目占据的主轴空间叫做main size,占据的交叉轴空间叫做cross size。
# 三、容器的属性
##### 以下6个属性设置在容器上。
- flex-direction
- flex-wrap
- flex-flow
- justify-content
- align-items
- align-content
### 3.1 flex-direction属性
flex-direction属性决定主轴的方向(即项目的排列方向)。
```
.box {
flex-direction: row | row-reverse | column | column-reverse;
}
```
![image][tmp2]
[tmp2]:data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAxwAAADL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56wgQIECAAAECBAgQmBUQOGaJFBAgQIAAAQIECBAgUCsgcNTKWUeAAAECBAgQIECAwKyAwDFLpIAAAQIECBAgQIAAgVoBgaNWzjoCBAgQIECAAAECBGYFBI5ZIgUECBAgQIAAAQIECNQK/B+Blna9eZe6UQAAAABJRU5ErkJggg==
它可能有4个值。
- row(默认值):主轴为水平方向,起点在左端。
- row-reverse:主轴为水平方向,起点在右端。
- column:主轴为垂直方向,起点在上沿。
- column-reverse:主轴为垂直方向,起点在下沿。
### 3.2 flex-wrap属性
默认情况下,项目都排在一条线(又称"轴线")上。flex-wrap属性定义,如果一条轴线排不下,如何换行。
![image][tmp3]
[tmp3]:data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAx4AAAEUCAMAAACS4BBDAAAAbFBMVEWJR5vogCT///+hVHzQcUHEos3i0ue3YmDIbEvZdjWrWnDEpM2ndLSmdLSQS5PDaVHXdTiQUqG2jcGYXaifaa749Pnx6fOugbrTu9rMr9TbxuDp3e3TutqmdbTq3u3Lr9O9mMe9l8ebUIX69vtB2/XdAAAIg0lEQVR42uzb0UojQRRF0c6FpGeYPEymnSQmCPr/Pym+Rg6toMWNrP0JBxZV3VCTpNB2koSHhIeEh/QuPKQYHlIMDymGhxTDQ4rhIcXwkGJ4SDE8pBgeUgwPKYaHFMNDiuEhxfCQYnhIMTykGB5SrBmPzbB+Tam/mztpbj3j780PbMYDDzzwwAMPPPC4CQ888IjhgQceMTzwwCOGBx54xPDAA48YHnjgEcMDDzxieOCBRwwPPPCI4YEHHjE88MAjhgceeMTwwAOPGB5fMPnD7rI9LXh0Do9vLk/+VG9dXxY82obHgNLpca23nvBoGx4DypM/bK87l6u+4TGmPPkBj77h8ZH8ucKj4Yx44PHZ8Ljv8MADDzzwwAMPPG7DAw88YnjggUcMj+/hcToe8OgUHsPLky9VFzw6hcfw5il2qXrGo1F4jGudx+FY/xc8+oTH8OYpt6/a4dEnPAa2zmN6rPqHR5vwGFCYPF2vDnh0CY+RrfOYTlV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