Koneteina
O pusa o se poloka faufale autu o Bootstrap o loʻo i ai, faʻapipiʻi, ma faʻaogaina au mea i totonu o se masini tuʻuina atu poʻo se vaʻaiga.
E faapefea ona latou galulue
O atigipusa o le elemene sili ona faʻatulagaina i Bootstrap ma e manaʻomia pe a faʻaogaina le matou faʻaogaina o le faʻaogaina . O koneteina e fa'aoga e fa'amau ai, pad, ma (o nisi taimi) fa'atotonu mea i totonu. E ui e mafai ona fa'aputuina pusa, ae o le tele o fa'atulagaga e le mana'omia ai se fa'aputuga.
Bootstrap e sau ma pusa eseese e tolu:
.container
, lea e setiina amax-width
i vaega ta'itasi tali.container-fluid
, lea ewidth: 100%
i'u uma lava malepe.container-{breakpoint}
, leawidth: 100%
se'ia o'o i le mea e momotu ai
O le laulau o lo'o i lalo o lo'o fa'aalia ai le max-width
fa'atusaina o atigipusa ta'itasi i le mea muamua .container
ma .container-fluid
le va'aiga ta'itasi.
Vaʻai i latou i faʻatinoga ma faʻatusatusa i latou i la matou Grid faʻataʻitaʻiga .
Fa'aopoopo la'ititi <576px |
Laiti ≥576px |
Medium ≥768px |
Tele ≥992px |
X- Lapopoa ≥1200px |
XX- Teletele ≥1400px |
|
---|---|---|---|---|---|---|
.container |
100% | 540px | 720px | 960px | 1140px | 1320px |
.container-sm |
100% | 540px | 720px | 960px | 1140px | 1320px |
.container-md |
100% | 100% | 720px | 960px | 1140px | 1320px |
.container-lg |
100% | 100% | 100% | 960px | 1140px | 1320px |
.container-xl |
100% | 100% | 100% | 100% | 1140px | 1320px |
.container-xxl |
100% | 100% | 100% | 100% | 100% | 1320px |
.container-fluid |
100% | 100% | 100% | 100% | 100% | 100% |
Pusa masani
O le matou vasega fa'aletonu .container
o se atigipusa tali, fa'amau-lautele, o lona uiga o max-width
suiga i nofoaga ta'itasi.
<div class="container">
<!-- Content here -->
</div>
Pusa tali
O pusa tali e mafai ai e oe ona faʻamaonia se vasega e 100% lautele seʻia oʻo i le tulaga faʻamaonia, a maeʻa ona matou faʻaoga max-width
s mo vaega taʻitasi maualuga. Mo se fa'ata'ita'iga, .container-sm
e 100% le lautele e amata ai se'ia o'o i le sm
va'aiga, lea o le a fa'ateleina i le md
, lg
, xl
, ma le xxl
.
<div class="container-sm">100% wide until small breakpoint</div>
<div class="container-md">100% wide until medium breakpoint</div>
<div class="container-lg">100% wide until large breakpoint</div>
<div class="container-xl">100% wide until extra large breakpoint</div>
<div class="container-xxl">100% wide until extra extra large breakpoint</div>
Pusa vai
Fa'aoga .container-fluid
mo se atigipusa lautele lautele, fa'asaga i le lautele atoa o le va'aiga.
<div class="container-fluid">
...
</div>
Sass
E pei ona faʻaalia i luga, Bootstrap e faʻatupuina se faasologa o vasega atigipusa muai faʻamalamalamaina e fesoasoani ia te oe e fausia le faʻatulagaina e te manaʻo ai. E mafai ona e fa'avasegaina nei vasega koneteina muamua e ala i le suia o le faafanua Sass (maua i _variables.scss
) e fa'amalosia ai i latou:
$container-max-widths: (
sm: 540px,
md: 720px,
lg: 960px,
xl: 1140px,
xxl: 1320px
);
I le faaopoopo atu i le faʻavasegaina o le Sass, e mafai foʻi ona e fatuina au lava koneteina ma la matou Sass mixin.
// Source mixin
@mixin make-container($padding-x: $container-padding-x) {
width: 100%;
padding-right: $padding-x;
padding-left: $padding-x;
margin-right: auto;
margin-left: auto;
}
// Usage
.custom-container {
@include make-container();
}
Mo nisi faʻamatalaga ma faʻataʻitaʻiga i le auala e sui ai a matou faʻafanua Sass ma fesuiaiga, faʻamolemole vaʻai i le vaega Sass o le Grid pepa .