Koluma
A'oa'o pe fa'afefea ona sui koluma ma ni nai filifiliga mo le fa'aogaina, fa'atonu, ma le fa'asili fa'afetai i la matou flexbox grid system. Ma le isi, va'ai pe fa'apefea ona fa'aogaina vasega koluma e fa'atautaia ai le lautele o elemene e le o fa'a'ala.
E faapefea ona latou galulue
-
O koluma e fausia i luga o le fausaga o flexbox. Flexbox o lona uiga e iai a matou filifiliga mo le suia o koluma taʻitasi ma faʻaleleia vaega o koluma i le laina tulaga . E te filifili pe fa'afefea ona tupu, fa'aiti'i, pe suia fo'i koluma.
-
Pe a fauina fa'asologa o fa'asologa, o mea uma e alu i koluma. O le fa'asologa o le fa'asologa o Bootstrap e alu mai lea atigipusa i lea laina i lea koluma i au mea. I taimi e le masani ai, e mafai ona e tuʻufaʻatasia anotusi ma koluma, ae ia nofouta e mafai ona i ai ni taunuuga e leʻi mafaufauina.
-
O le Bootstrap e aofia ai vasega faʻatulagaina mo le fatuina o faʻatulagaga vave, tali. Faatasi ai ma le ono motumotu ma le sefulu lua koluma i laina taʻitasi, e tele a matou vasega ua uma ona fausia mo oe e fai ai au faʻatulagaga manaʻomia. E mafai ona fa'agata e ala i Sass pe a e mana'o ai.
Fa'atonuga
Fa'aoga mea fa'aoga fa'aoga flexbox e fa'aoga ai koluma i luga ma fa'alava.
Fa'aoga tu'usa'o
<div class="container">
<div class="row align-items-start">
<div class="col">
One of three columns
</div>
<div class="col">
One of three columns
</div>
<div class="col">
One of three columns
</div>
</div>
<div class="row align-items-center">
<div class="col">
One of three columns
</div>
<div class="col">
One of three columns
</div>
<div class="col">
One of three columns
</div>
</div>
<div class="row align-items-end">
<div class="col">
One of three columns
</div>
<div class="col">
One of three columns
</div>
<div class="col">
One of three columns
</div>
</div>
</div>
<div class="container">
<div class="row">
<div class="col align-self-start">
One of three columns
</div>
<div class="col align-self-center">
One of three columns
</div>
<div class="col align-self-end">
One of three columns
</div>
</div>
</div>
Fa'asagaga fa'asaga
<div class="container">
<div class="row justify-content-start">
<div class="col-4">
One of two columns
</div>
<div class="col-4">
One of two columns
</div>
</div>
<div class="row justify-content-center">
<div class="col-4">
One of two columns
</div>
<div class="col-4">
One of two columns
</div>
</div>
<div class="row justify-content-end">
<div class="col-4">
One of two columns
</div>
<div class="col-4">
One of two columns
</div>
</div>
<div class="row justify-content-around">
<div class="col-4">
One of two columns
</div>
<div class="col-4">
One of two columns
</div>
</div>
<div class="row justify-content-between">
<div class="col-4">
One of two columns
</div>
<div class="col-4">
One of two columns
</div>
</div>
<div class="row justify-content-evenly">
<div class="col-4">
One of two columns
</div>
<div class="col-4">
One of two columns
</div>
</div>
</div>
afifiina koluma
Afai e sili atu i le 12 koluma e tu'u i totonu o le laina e tasi, o vaega ta'itasi o isi koluma o le a, e tasi le iunite, afifi i se laina fou.
Talu mai le 9 + 4 = 13 > 12, o le vaega lea e 4-koluma-lautele e afifi i luga o se laina fou o se tasi o iunite soso'o.
O koluma mulimuli ane e fa'aauau i luga o le laina fou.
<div class="container">
<div class="row">
<div class="col-9">.col-9</div>
<div class="col-4">.col-4<br>Since 9 + 4 = 13 > 12, this 4-column-wide div gets wrapped onto a new line as one contiguous unit.</div>
<div class="col-6">.col-6<br>Subsequent columns continue along the new line.</div>
</div>
</div>
Tu'u koluma
O le talepeina o koluma i se laina fou i le flexbox e manaʻomia ai se tamai hack: faʻaopoopo se elemene i width: 100%
soʻo se mea e te manaʻo e afifi ai au koluma i se laina fou. E masani lava e ausia lenei mea i le tele o .row
s, ae le o metotia faʻatinoga uma e mafai ona faʻamaonia mo lenei mea.
<div class="container">
<div class="row">
<div class="col-6 col-sm-3">.col-6 .col-sm-3</div>
<div class="col-6 col-sm-3">.col-6 .col-sm-3</div>
<!-- Force next columns to break to new line -->
<div class="w-100"></div>
<div class="col-6 col-sm-3">.col-6 .col-sm-3</div>
<div class="col-6 col-sm-3">.col-6 .col-sm-3</div>
</div>
</div>
E mafai fo'i ona e fa'aogaina lenei malologa i nofoaga fa'apitoa fa'atasi ma a matou fa'aoga fa'aaliga tali .
<div class="container">
<div class="row">
<div class="col-6 col-sm-4">.col-6 .col-sm-4</div>
<div class="col-6 col-sm-4">.col-6 .col-sm-4</div>
<!-- Force next columns to break to new line at md breakpoint and up -->
<div class="w-100 d-none d-md-block"></div>
<div class="col-6 col-sm-4">.col-6 .col-sm-4</div>
<div class="col-6 col-sm-4">.col-6 .col-sm-4</div>
</div>
</div>
Toe fa'atonu
Oka vasega
Fa'aoga .order-
vasega mo le fa'atonutonuina o le fa'atonuga va'aia o au mea. O nei vasega e tali mai, o lea e mafai ai ona e setiina le order
mea e momotu ai (faataitaiga, .order-1.order-md-2
). E aofia ai le lagolago 1
i 5
vaega uma e ono.
<div class="container">
<div class="row">
<div class="col">
First in DOM, no order applied
</div>
<div class="col order-5">
Second in DOM, with a larger order
</div>
<div class="col order-1">
Third in DOM, with an order of 1
</div>
</div>
</div>
E iai fo'i tali .order-first
ma .order-last
vasega e suia ai le order
elemene e ala i le fa'aogaina order: -1
ma le order: 6
, i le faasologa. O nei vasega e mafai fo'i ona fa'afefiloi ma .order-*
vasega fa'anumera pe a mana'omia.
<div class="container">
<div class="row">
<div class="col order-last">
First in DOM, ordered last
</div>
<div class="col">
Second in DOM, unordered
</div>
<div class="col order-first">
Third in DOM, ordered first
</div>
</div>
</div>
Fa'ase'e koluma
E mafai ona e fa'asili koluma fa'asologa i ni auala se lua: matou .offset-
vasega fa'avasega tali ma a matou mea fa'aoga pito i tua . O vasega fa'ava'a e fa'atutusa e fa'afetaui koluma a'o pito e sili atu ona aoga mo fa'ata'ita'iga vave e fesuia'i ai le lautele o le offset.
Offset vasega
Fa'asolo koluma i le itu taumatau e fa'aoga ai .offset-md-*
vasega. O nei vasega e fa'ateleina le pito agavale o se koluma i *
koluma. Mo se fa'ata'ita'iga, .offset-md-4
fa'agaoioi .col-md-4
luga o koluma e fa.
<div class="container">
<div class="row">
<div class="col-md-4">.col-md-4</div>
<div class="col-md-4 offset-md-4">.col-md-4 .offset-md-4</div>
</div>
<div class="row">
<div class="col-md-3 offset-md-3">.col-md-3 .offset-md-3</div>
<div class="col-md-3 offset-md-3">.col-md-3 .offset-md-3</div>
</div>
<div class="row">
<div class="col-md-6 offset-md-3">.col-md-6 .offset-md-3</div>
</div>
</div>
I le faaopoopo atu i le kiliaina o koluma i nofoaga malolo tali, atonu e te manaʻomia le toe setiina offsets. Va'ai i le fa'atinoga i le fa'ata'ita'iga fa'asologa .
<div class="container">
<div class="row">
<div class="col-sm-5 col-md-6">.col-sm-5 .col-md-6</div>
<div class="col-sm-5 offset-sm-2 col-md-6 offset-md-0">.col-sm-5 .offset-sm-2 .col-md-6 .offset-md-0</div>
</div>
<div class="row">
<div class="col-sm-6 col-md-5 col-lg-6">.col-sm-6 .col-md-5 .col-lg-6</div>
<div class="col-sm-6 col-md-5 offset-md-2 col-lg-6 offset-lg-0">.col-sm-6 .col-md-5 .offset-md-2 .col-lg-6 .offset-lg-0</div>
</div>
</div>
Fa'aoga pito i tua
Faatasi ai ma le siitia atu i le flexbox i le v4, e mafai ona e faʻaogaina mea faʻaoga faʻapitoa e pei .me-auto
o le faʻamalosi o nai koluma mai le isi.
<div class="container">
<div class="row">
<div class="col-md-4">.col-md-4</div>
<div class="col-md-4 ms-auto">.col-md-4 .ms-auto</div>
</div>
<div class="row">
<div class="col-md-3 ms-md-auto">.col-md-3 .ms-md-auto</div>
<div class="col-md-3 ms-md-auto">.col-md-3 .ms-md-auto</div>
</div>
<div class="row">
<div class="col-auto me-auto">.col-auto .me-auto</div>
<div class="col-auto">.col-auto</div>
</div>
</div>
Tu'atasi vasega koluma
E .col-*
mafai fo'i ona fa'aoga vasega i fafo a .row
e tu'uina atu i se elemene se lautele fa'apitoa. So'o se taimi lava e fa'aoga ai vasega koluma e pei o tamaiti e le tuusa'o o se laina, e fa'ate'aina fo'i.
<div class="col-3 bg-light p-3 border">
.col-3: width of 25%
</div>
<div class="col-sm-9 bg-light p-3 border">
.col-sm-9: width of 75% above sm breakpoint
</div>
O vasega e mafai ona faʻaoga faʻatasi ma mea faʻaoga e fatu ai ata faʻafefete tali. Ia mautinoa e afifi le mea i totonu o se .clearfix
afifi e faʻamalo ai le faʻanofo pe afai e pupuu le tusitusiga.
O se parakalafa o tusitusiga o lo'o tu'u iai. Matou te faʻaaogaina iinei e faʻaalia ai le faʻaogaina o le vasega clearfix. O lo'o matou fa'aopoopoina ni nai fa'aupuga leai se uiga iinei e fa'aalia ai pe fa'afefea ona fegalegaleai ia koluma iinei ma le ata fa'afefeteina.
E pei ona mafai ona e vaʻai i parakalafa o loʻo afifi lelei i luga o le ata faʻafefe. Va'ai la pe fa'afefea ona va'ai lenei mea i ni mea moni o lo'o i totonu, nai lo na'o lenei mea fa'anofonofo fa'amaufa'ailoga e fa'aauau pea, ae o le mea moni e leai ni fa'amatalaga moni i. E na'o le tele o avanoa ma e le tatau ona faitau.
Ae ui i lea, o oe lea, o loʻo e faʻaauau pea i le faitauina o lenei tusitusiga, faʻamoemoe mo nisi faʻamatalaga, poʻo se fuamoa natia o le Eseta o mea. O se tala malie, masalo. Ae paga lea, e leai se mea faapena iinei.
<div class="clearfix">
<img src="..." class="col-md-6 float-md-end mb-3 ms-md-3" alt="...">
<p>
A paragraph of placeholder text. We're using it here to show the use of the clearfix class. We're adding quite a few meaningless phrases here to demonstrate how the columns interact here with the floated image.
</p>
<p>
As you can see the paragraphs gracefully wrap around the floated image. Now imagine how this would look with some actual content in here, rather than just this boring placeholder text that goes on and on, but actually conveys no tangible information at. It simply takes up space and should not really be read.
</p>
<p>
And yet, here you are, still persevering in reading this placeholder text, hoping for some more insights, or some hidden easter egg of content. A joke, perhaps. Unfortunately, there's none of that here.
</p>
</div>