faaputuga
Fesoasoani fa'apuupuu o lo'o fausia i luga oa tatou mea fa'aoga flexbox ina ia fa'avavevave ma fa'afaigofie le fa'atulagaina o vaega nai lo se isi lava taimi.
Stacks e ofoina atu se ala ala mo le faʻaogaina o le tele o mea faʻapipiʻi flexbox e vave ma faigofie ai ona fai faʻasologa i Bootstrap. O fa'atagaga uma mo le manatu ma le fa'atinoga o lo'o alu i le open source Pylon project .
Tusa'o
Fa'aoga .vstack
e fai ai fa'ata'atia sa'o. O mea fa'aputu e fa'ato'atoa lautele ona o le fa'aletonu. Fa'aoga .gap-*
mea aoga e fa'aopoopo ai avanoa i le va o mea.
<div class="vstack gap-3">
<div class="bg-light border">First item</div>
<div class="bg-light border">Second item</div>
<div class="bg-light border">Third item</div>
</div>
Fa'asagaga
Fa'aoga .hstack
mo fa'alava fa'ata'atia. O mea fa'aputu e fa'atotonugatotonu i luga ona o le fa'aletonu ma e na'o le lautele e mana'omia. Fa'aoga .gap-*
mea aoga e fa'aopoopo ai avanoa i le va o mea.
<div class="hstack gap-3">
<div class="bg-light border">First item</div>
<div class="bg-light border">Second item</div>
<div class="bg-light border">Third item</div>
</div>
Fa'aaogā fa'aoga fa'alava fa'ata'amilo e pei .ms-auto
o spacers:
<div class="hstack gap-3">
<div class="bg-light border">First item</div>
<div class="bg-light border ms-auto">Second item</div>
<div class="bg-light border">Third item</div>
</div>
Ma faʻatasi ai ma tulafono faʻavae :
<div class="hstack gap-3">
<div class="bg-light border">First item</div>
<div class="bg-light border ms-auto">Second item</div>
<div class="vr"></div>
<div class="bg-light border">Third item</div>
</div>
Faataitaiga
Fa'aoga .vstack
e fa'aputu ai fa'amau ma isi elemene:
<div class="vstack gap-2 col-md-5 mx-auto">
<button type="button" class="btn btn-secondary">Save changes</button>
<button type="button" class="btn btn-outline-secondary">Cancel</button>
</div>
Fausia se fomu i totonu ma .hstack
:
<div class="hstack gap-3">
<input class="form-control me-auto" type="text" placeholder="Add your item here..." aria-label="Add your item here...">
<button type="button" class="btn btn-secondary">Submit</button>
<div class="vr"></div>
<button type="button" class="btn btn-outline-danger">Reset</button>
</div>
Sass
.hstack {
display: flex;
flex-direction: row;
align-items: center;
align-self: stretch;
}
.vstack {
display: flex;
flex: 1 1 auto;
flex-direction: column;
align-self: stretch;
}