CSS3 Flex Box 彈性框的概念

有關 Flex Box 彈性框的新屬性
| no | 應用於 | 屬性名稱 | 說明 | 屬性值 | 說明 | 範例 | 
|---|---|---|---|---|---|---|
| 1 | container | display | 彈性框的模式 | flex | inline-flex | ||
| 2 | container | flex-wrap | 內容項目是否換行 | nowrap | wrap | wrap-reverse | w3s | w3s | 
| 3 | container | flex-direction | 內容項目排列方向 | row | row-reverse | column | column-reverse | w3s | w3s | 
| 4 | container | justify-content | (尚未改變方向時) 內容項目水平對齊方式  | 
        flex-start | flex-end | center | space-between | space-around | space-evenly  | 
        w3s | w3s | 
| 5 | container | align-items | (尚未改變方向時) 內容項目垂直對齊方式 (文字為主)  | 
        stretch | center | flex-start | flex-end | baseline | w3s | w3s | 
| 6 | container | align-content | (尚未改變方向時) 內容項目垂直對齊方式 (框架為主)  | 
        stretch | center | flex-start | flex-end | space-between | space-around | space-evenly  | 
        w3s | w3s | 
| 7 | container | flex-flow | 同時設定方向及換行 | flex-direction + flex-wrap | w3s | w3s | 
| no | 應用於 | 屬性名稱 | 說明 | w3s | 範例 | 範例 | 
|---|---|---|---|---|---|---|
| 8 | item | flex-grow | 單項寬度的放大比例, 預設 0 表示不會跟著放大,  設定 1 以上為放大比例, 並且會填滿父層空間  | 
        w3s | w3s | w3s | 
| 9 | item | flex-shrink | 單項寬度的縮小比例, 預設1, 設定0表示不會跟著縮小 | w3s | w3s | w3s | 
| 10 | item | flex-basis | 單項寬度的初始設定(px、em、%...) | w3s | w3s | w3s | 
| 11 | item | flex | 是 flex-grow、flex-shrink 和 flex-basis 的合併簡寫模式 預設值為 0 1 auto  | 
        w3s | w3s | w3s | 
| 12 | item | align-self | 指定項目的垂直對齊方式 | w3s | w3s | w3s | 
| 13 | item | order | 內容項目指定排列順序, 每個單項預設為 0 | w3s | w3s | w3s | 
範例已設定好的部份
<div class="container">
    <div class="item"></div>
    <div class="item"></div>
    <div class="item"></div>
</div>
<style>
.container { background-color: #ffc0ee; max-width: 800px; min-height: 200px; 
              margin: 10px auto; padding: 5px; }
.item { background-color: #a2a2f0; margin: 5px; padding: 5px; }
</style>
1. 彈性框的指定顯示模式 ( display : flex | inline-flex ) TOP
      Item1
        Item2 Item2 
        Item3 Item3 Item3
      2. 內容項目是否換行 TOP ( flex-wrap : nowrap | wrap | wrap-reverse | initial )
Item1
        Item2
        Item3
        Item4
        Item5
        Item6
        Item7
        Item8
        Item9
        Item1
        Item2
        Item3
        Item4
        Item5
        Item6
        Item7
        Item8
        Item9
       3. 內容項目排列方向  
    TOP
    
 ( flex-direction : row | row-reverse | column | column-reverse | initial )
  Item1
        Item2 Item2 
        Item3 Item3 Item3
       4. 內容項目水平對齊方式 (尚未改變方向時) 
    TOP
    
 ( justify-content : flex-start | flex-end | center | space-between | space-around | space-evenly )
  Item1
        Item2 Item2 
        Item3 Item3 Item3
       5. 內容項目垂直對齊方式(文字為主)  (尚未改變方向時)
    TOP
    
 ( align-items : stretch | center | flex-start | flex-end | baseline | initial )
  Item1
        Item2 Item2 
        Item3 Item3 Item3
       6. 內容項目垂直對齊方式(框架為主)  (尚未改變方向時)
    TOP
    
 ---- 每個 .item 加了設計 width: 100px;   
    
 ---- 如果內容項目沒有超過一列、沒有換行呈現,那麼這個設定就沒有變化
    
    ( align-content : stretch | center | flex-start | flex-end | space-between | space-around | space-evenly )
  
  Item1
        Item2
        Item3
        Item4
        Item5
        Item6
        Item7
        Item8
        Item9
      
【綜合測試學習範例】
測試練習:導覽按鈕在導覽區的右下角 參考結果
測試練習:導覽按鈕在導覽區的水平中央垂直貼下 參考結果
測試練習:導覽按鈕在導覽區的正中央 參考結果
測試練習:圖文排版、奇偶左右換位、上下偏移錯位 參考結果
測試練習:單項內容寬度的放大、縮小 參考結果
 WEB 