Ebe nkwụsịtụ
Ebe nkwụsịtụ bụ obosara nwere ike ịhazigharị nke na-ekpebi ka nhazi nzaghachi gị si eme n'ofe ngwaọrụ ma ọ bụ nha nlele na Bootstrap.
Isi echiche
-
Ebe nkwụsịtụ bụ ihe mgbakwasị ụkwụ nke imewe na-anabata. Jiri ha jikwaa mgbe enwere ike imegharị okirikiri nhọrọ ukwuu gị n'otu ebe nlele ma ọ bụ nha ngwaọrụ.
-
Jiri ajụjụ mgbasa ozi iji hazie CSS gị site na ebe nkwụsịtụ. Ajuju mgbasa ozi bụ akụkụ nke CSS na-enye gị ohere itinye ụdịdị dabere na ntọala ihe nchọgharị na sistemụ arụmọrụ. Anyị na-ejikarị
min-width
na ajụjụ mgbasa ozi anyị. -
Mobile mbụ, anabata imewe bụ ihe mgbaru ọsọ. Bootstrap's CSS bu n'obi itinye opekempe nke ụdị iji mee ka nhazi ya rụọ ọrụ na ebe nkwụsịtụ kacha nta, wee tinye ya n'ụdị iji dozie nhazi ahụ maka ngwaọrụ ndị buru ibu. Nke a na-ebuli CSS gị elu, na-emezigharị oge, ma na-enye ndị ọbịa gị ọmarịcha ahụmahụ.
Ebe nkwụsịtụ dị
Bootstrap gụnyere ntụpọ ndabara isii, mgbe ụfọdụ a na-akpọ grid tiers , maka iwulite nke ọma. Enwere ike ịhazi ebe nkwụsịtụ ndị a ma ọ bụrụ na ị na-eji faịlụ Sass isi iyi anyị.
Ebe nkwụsịtụ | Infix klaasị | Akụkụ |
---|---|---|
X-obere | Ọ dịghị | <576px |
Obere | sm |
≥576px |
Ọkara | md |
≥768px |
Nnukwu | lg |
≥992px |
Nnukwu ibu | xl |
≥1200px |
Mgbakwunye nnukwu | xxl |
≥1400px |
Onye ọ bụla breakpoint e họọrọ ka nkasi obi jide containers nke widths bụ multiples nke 12. Breakpoints bụkwa ndị nnọchiteanya nke a subset nke nkịtị ngwaọrụ nha na viewport akụkụ-ha adịghị kpọmkwem nwaa ọ bụla ojiji ikpe ma ọ bụ ngwaọrụ. Kama, oke ndị ahụ na-enye ntọala siri ike ma na-agbanwe agbanwe iji wuo ihe fọrọ nke nta ka ọ bụrụ ngwaọrụ ọ bụla.
A na-ahazi ebe nkwụsịtụ ndị a site na Sass - ị ga-ahụ ha na maapụ Sass na mpempe akwụkwọ anyị _variables.scss
.
$grid-breakpoints: (
xs: 0,
sm: 576px,
md: 768px,
lg: 992px,
xl: 1200px,
xxl: 1400px
);
Maka ozi ndị ọzọ na ihe atụ maka otu esi agbanwe maapụ Sass na mgbanwe, biko rụtụ aka na ngalaba Sass nke akwụkwọ Grid .
Ajụjụ mgbasa ozi
Ebe ọ bụ na ebu ụzọ mepụta Bootstrap ka ọ bụrụ ekwentị mkpanaaka, anyị na-eji ajụjụ mgbasa ozi dị ole na ole mepụta ebe nkwụsịtụ nwere ezi uche maka nhazi na ihu anyị. Ebe nkwụsịtụ ndị a na-adaberekarị na obosara nlele opekempe ma na-enye anyị ohere ịbawanye ihe dị ka ihe nlele na-agbanwe.
Obere-obosara
Bootstrap na-eji usoro ajụjụ mgbasa ozi ndị a na-esonụ-ma ọ bụ ebe nkwụsịtụ-na faịlụ Sass anyị maka nhazi, usoro grid, na akụrụngwa anyị.
// Source mixins
// No media query necessary for xs breakpoint as it's effectively `@media (min-width: 0) { ... }`
@include media-breakpoint-up(sm) { ... }
@include media-breakpoint-up(md) { ... }
@include media-breakpoint-up(lg) { ... }
@include media-breakpoint-up(xl) { ... }
@include media-breakpoint-up(xxl) { ... }
// Usage
// Example: Hide starting at `min-width: 0`, and then show at the `sm` breakpoint
.custom-class {
display: none;
}
@include media-breakpoint-up(sm) {
.custom-class {
display: block;
}
}
Ngwakọta Sass ndị a na-atụgharị na CSS anyị achịkọtara site na iji ụkpụrụ ekwuputara na mgbanwe Sass anyị. Ọmụmaatụ:
// X-Small devices (portrait phones, less than 576px)
// No media query for `xs` since this is the default in Bootstrap
// Small devices (landscape phones, 576px and up)
@media (min-width: 576px) { ... }
// Medium devices (tablets, 768px and up)
@media (min-width: 768px) { ... }
// Large devices (desktops, 992px and up)
@media (min-width: 992px) { ... }
// X-Large devices (large desktops, 1200px and up)
@media (min-width: 1200px) { ... }
// XX-Large devices (larger desktops, 1400px and up)
@media (min-width: 1400px) { ... }
Oke-obosara
Anyị na-eji ajụjụ mgbasa ozi na-aga n'akụkụ ọzọ (nha ihuenyo enyere ma ọ bụ obere ):
// No media query necessary for xs breakpoint as it's effectively `@media (max-width: 0) { ... }`
@include media-breakpoint-down(sm) { ... }
@include media-breakpoint-down(md) { ... }
@include media-breakpoint-down(lg) { ... }
@include media-breakpoint-down(xl) { ... }
@include media-breakpoint-down(xxl) { ... }
// Example: Style from medium breakpoint and down
@include media-breakpoint-down(md) {
.custom-class {
display: block;
}
}
Ngwakọta ndị a na-ewere ntụpọ nkwụsịtụ ndị ahụ ekwuputara, wepụ .02px
na ha, ma jiri ha dị ka max-width
ụkpụrụ anyị. Ọmụmaatụ:
// `xs` returns only a ruleset and no media query
// ... { ... }
// `sm` applies to x-small devices (portrait phones, less than 576px)
@media (max-width: 575.98px) { ... }
// `md` applies to small devices (landscape phones, less than 768px)
@media (max-width: 767.98px) { ... }
// `lg` applies to medium devices (tablets, less than 992px)
@media (max-width: 991.98px) { ... }
// `xl` applies to large devices (desktops, less than 1200px)
@media (max-width: 1199.98px) { ... }
// `xxl` applies to x-large devices (large desktops, less than 1400px)
@media (max-width: 1399.98px) { ... }
min-
namax-
nlele nwere obosara akụkụ (nke nwere ike ime n'okpuru ọnọdụ ụfọdụ na ngwaọrụ dpi dị elu, dịka ọmụmaatụ) site na iji ụkpụrụ nwere nkenke dị elu.
Otu nkwụsịtụ
Enwekwara ajụjụ mgbasa ozi na mixins maka ịchebe otu akụkụ nke nha ihuenyo site na iji opekempe na obosara nkwụsịtụ kacha.
@include media-breakpoint-only(xs) { ... }
@include media-breakpoint-only(sm) { ... }
@include media-breakpoint-only(md) { ... }
@include media-breakpoint-only(lg) { ... }
@include media-breakpoint-only(xl) { ... }
@include media-breakpoint-only(xxl) { ... }
Dịka ọmụmaatụ, ọ @include media-breakpoint-only(md) { ... }
ga-ebute:
@media (min-width: 768px) and (max-width: 991.98px) { ... }
N'etiti ebe nkwụsịtụ
N'otu aka ahụ, ajụjụ mgbasa ozi nwere ike gbasaa ọtụtụ obosara nkwụsịtụ:
@include media-breakpoint-between(md, xl) { ... }
Nke na-ebute:
// Example
// Apply styles starting from medium devices and up to extra large devices
@media (min-width: 768px) and (max-width: 1199.98px) { ... }