<divclass="container text-center"> <divclass="row align-items-start"> <divclass="col"> One of three columns </div> <divclass="col"> One of three columns </div> <divclass="col"> One of three columns </div> </div> </div>
垂直對齊
1 2 3 4 5 6 7 8 9 10 11 12 13
<divclass="container text-center"> <divclass="row align-items-center"> <divclass="col"> One of three columns </div> <divclass="col"> One of three columns </div> <divclass="col"> One of three columns </div> </div> </div>
往下對齊
1 2 3 4 5 6 7 8 9 10 11 12 13
<divclass="container text-center"> <divclass="row align-items-end"> <divclass="col"> One of three columns </div> <divclass="col"> One of three columns </div> <divclass="col"> One of three columns </div> </div> </div>
對齊單一子元素
1 2 3 4 5 6 7 8 9 10 11 12 13
<divclass="container text-center"> <divclass="row"> <divclass="col align-self-start"> One of three columns </div> <divclass="col align-self-center"> One of three columns </div> <divclass="col align-self-end"> One of three columns </div> </div> </div>
<divclass="container text-center"> <divclass="row justify-content-start"> <divclass="col-4"> One of two columns </div> <divclass="col-4"> One of two columns </div> </div> <divclass="row justify-content-center"> <divclass="col-4"> One of two columns </div> <divclass="col-4"> One of two columns </div> </div> <divclass="row justify-content-end"> <divclass="col-4"> One of two columns </div> <divclass="col-4"> One of two columns </div> </div> <divclass="row justify-content-around"> <divclass="col-4"> One of two columns </div> <divclass="col-4"> One of two columns </div> </div> <divclass="row justify-content-between"> <divclass="col-4"> One of two columns </div> <divclass="col-4"> One of two columns </div> </div> <divclass="row justify-content-evenly"> <divclass="col-4"> One of two columns </div> <divclass="col-4"> One of two columns </div> </div> </div>
column 斷行
當你想讓 col 斷行到下一行,又不想加入新的一列 .row 時,可以在 col 跟 col 間用 w-100的div
在 col 使用 .order-* 來控制 col 顯示順序,預設提供 order 1 - 5 可以設定。 order 值越小的會往前排。
1 2 3 4 5 6 7 8 9 10 11 12 13
<divclass="container text-center"> <divclass="row"> <divclass="col"> First in DOM, no order applied </div> <divclass="col order-5"> Second in DOM, with a larger order </div> <divclass="col order-1"> Third in DOM, with an order of 1 </div> </div> </div>
.order-first: 會套用 order: -1,讓元素排到最前面。
.order-last : 會套用 order: 6,讓元素排到最後面。
Offsetting 推移 col
在 col 上用 offset-*,讓 col 增加 margin-left 向左推移。 舉例: .offset-md-4 會向左推移四個單位