Staklar
Komponentlar tartibini har qachongidan ham tezroq va oson qilish uchun bizning flexbox yordamchi dasturlarimiz ustiga qurilgan stenografiya yordamchilari.
Stacks Bootstrap-da tartiblarni tez va oson yaratish uchun bir qator flexbox xususiyatlarini qo'llash uchun yorliqni taklif qiladi. Kontseptsiya va amalga oshirish uchun barcha kredit ochiq manba Pylon loyihasiga tushadi .
Vertikal
.vstack
Vertikal tartiblarni yaratish uchun foydalaning . Yig'ilgan elementlar sukut bo'yicha to'liq kenglikda. .gap-*
Elementlar orasiga bo'sh joy qo'shish uchun yordamchi dasturlardan foydalaning .
<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>
Gorizontal
.hstack
Gorizontal sxemalar uchun foydalaning . Yig'ilgan elementlar sukut bo'yicha vertikal markazlashtirilgan va faqat kerakli kenglikni egallaydi. .gap-*
Elementlar orasiga bo'sh joy qo'shish uchun yordamchi dasturlardan foydalaning .
<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>
Gorizontal marja yordam vositalaridan, masalan .ms-auto
, ajratgichlar sifatida foydalanish:
<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>
Va vertikal qoidalar bilan :
<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>
Misollar
.vstack
Tugmalar va boshqa elementlarni yig'ish uchun foydalaning :
<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>
Quyidagi bilan ichki shakl yarating .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;
}