彈性盒包括:
彈性容器 和 彈性子元素
彈性容器設(shè)置display:flex;
然后給彈性容器設(shè)置其他的屬性
1.順序指定了彈性子元素在父容器中的位置。
? flex-direction:
? ? 主軸方向:
? ? row 從左向右
? ? row-reverse
? ? 側(cè)軸方向
? ? column從上到下
? ? column-reverse
2.內(nèi)容對齊屬性蝙寨,屬性應(yīng)用在彈性容器上端壳,把彈性子元素沿著彈性容器的主軸線對齊
(橫向)
justify-content:
? ? flex-start
? ? ? ? ? ? flex-end
? ? ? ? ? ? center
? ? ? ? ? ? space-between
? ? ? ? ? ? space-around
3.設(shè)置或者檢索彈性盒子元素在側(cè)軸(縱軸)方向上的對齊方式
(縱向)
? ? ? ? align-items:
? ? ? ? ? ? flex-start
? ? ? ? ? ? flex-end
? ? ? ? ? ? center
? ? ? ? ? ? baseline 這個相當(dāng)于flex-start
? ? ? ? ? ? stretch 這個屬性暑认,如果彈性父容器沒有設(shè)置高度忽孽,或者設(shè)置高度為auto,
? ? ? ? ? ? ? ? ? ? 那么彈性父容器盡可能的滿足彈性子元素的高度
4.設(shè)置彈性子元素的換行方式
? ? ? ? ? flex-wrap:
? ? ? ? ? ? ? nowrap 彈性容器為單行靴患,彈性子元素在彈性容器大小太小的情況下桨菜,會溢出容器
? ? ? ? ? ? ? wrap 彈性子元素不滿一行換行
? ? ? ? ? ? ? wrap-reverse
? ? ? ? ? ? ? initial
? ? ? ? ? ? ? inherit
5.設(shè)置彈性容器中的各個行的對齊坎匿,不是設(shè)置彈性子元素的對齊
? ? ? ? align-content:
? ? ? ? ? ? flex-start
? ? ? ? ? ? flex-end
? ? ? ? ? ? center
? ? ? ? ? ? space-between
? ? ? ? ? ? space-around
? ? ? ? ? ? stretch
二、單獨針對彈性子元素設(shè)置的屬性:
1雷激、彈性盒子中彈性子元素自身在側(cè)軸(縱軸)方向上的對齊方式:
這個屬性設(shè)置是在彈性容器設(shè)置了flex相關(guān)屬性后替蔬,再給彈性子元素設(shè)置下面的屬性,以達到
某一個彈性子元素在側(cè)軸(縱軸)方向上的對齊方式屎暇,是在開始的位置承桥,還是在中間,還是在末尾
顯示的屬性設(shè)置
align-self:
auto
flex-start
flex-end
center
baseline
stretch
2根悼、給指定的彈性子元素分配空間
? flex:
none? 關(guān)鍵字的計算值為:0 0 auto
flex-grow? 定義彈性盒子元素的擴展比率
flex-shrink? 定義彈性盒子元素的收縮比率
flex-basis 定義彈性盒子元素的默認基準值