Nchịkọta
Ndị enyemaka Shorthand na-ewu n'elu akụrụngwa flexbox anyị iji mee nhazi akụrụngwa ngwa ngwa na dị mfe karịa mgbe ọ bụla.
Stacks na-enye ụzọ mkpirisi maka itinye ọtụtụ akụrụngwa flexbox iji mepụta nhazi ngwa ngwa na ngwa ngwa na Bootstrap. Ekele niile maka echiche na mmejuputa a na-aga na ọrụ Pylon mepere emepe .
kwụ ọtọ
Jiri .vstack
mepụta okirikiri nhọrọ ukwuu. Ihe ndị ekpokọbara nwere obosara na ndabara. Jiri .gap-*
akụrụngwa tinye ohere n'etiti ihe.
<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>
Kehoraizin
Jiri .hstack
maka okirikiri nhọrọ ukwuu. A na-adabere na ndabara n'etiti ihe ndị ekpokọtara ọnụ ma buru naanị obosara ha dị mkpa. Jiri .gap-*
akụrụngwa tinye ohere n'etiti ihe.
<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>
Iji akụrụngwa oke kwụ ọtọ dị .ms-auto
ka 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>
Ya na iwu kwụ ọtọ :
<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>
Ihe atụ
Jiri .vstack
iji kpokọta bọtịnụ na ihe ndị ọzọ:
<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>
Mepụta fọm inline na .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;
}