Ebitundu ebikola omubiri
Yiga engeri era lwaki tuzimba kumpi ebitundu byaffe byonna nga tuddamu era nga tulina kiraasi za base ne modifier.
Ebisulo bya base
Ebitundu bya Bootstrap okusinga bizimbibwa nga biriko entuuma ya base-modifier. Tugatta eby’obugagga bingi ebigabanyizibwa nga bwe kisoboka mu kiraasi ey’omusingi, nga .btn
, n’oluvannyuma tugatta emisono egy’enjawulo ku buli nkyukakyuka mu bibinja by’ebikyusa, nga .btn-primary
oba .btn-success
.
Okuzimba ebika byaffe eby'okukyusa, tukozesa @each
loopu za Sass okuddiŋŋana ku maapu ya Sass. Kino kiyamba naddala okukola enjawulo z’ekitundu nga zaffe $theme-colors
n’okukola enjawulo eziddamu ku buli breakpoint. Nga bw’olongoosa maapu zino eza Sass n’okuddamu okukung’aanya, ojja kulaba enkyukakyuka zo nga zeeyolekera mu loopu zino.
Laba Sass maps ne loops docs zaffe ku ngeri y'okulongoosaamu loopu zino n'okugaziya enkola ya Bootstrap eya base-modifier ku code yo.
Ebikyusakyusa
Ebitundu bingi ebya Bootstrap bizimbibwa n’enkola ya base-modifier class. Kino kitegeeza nti ekitundu ekinene eky’okukola sitayiro kibeera mu kiraasi ey’omusingi (okugeza, .btn
) ate enjawulo za sitayiro zikoma ku kiraasi z’abakyusa (okugeza, .btn-danger
). Zino modifier classes zizimbibwa okuva ku $theme-colors
maapu okukola customizing ennamba n'erinnya lya modifier classes zaffe.
Wano waliwo ebyokulabirako bibiri ku ngeri gye tukola loopu ku $theme-colors
maapu okukola ebikyusakyusa ku bitundu .alert
ne .list-group
.
// Generate contextual modifier classes for colorizing the alert.
@each $state, $value in $theme-colors {
$alert-background: shift-color($value, $alert-bg-scale);
$alert-border: shift-color($value, $alert-border-scale);
$alert-color: shift-color($value, $alert-color-scale);
@if (contrast-ratio($alert-background, $alert-color) < $min-contrast-ratio) {
$alert-color: mix($value, color-contrast($alert-background), abs($alert-color-scale));
}
.alert-#{$state} {
@include alert-variant($alert-background, $alert-border, $alert-color);
}
}
// List group contextual variants
//
// Add modifier classes to change text and background color on individual items.
// Organizationally, this must come after the `:hover` states.
@each $state, $value in $theme-colors {
$list-group-variant-bg: shift-color($value, $list-group-item-bg-scale);
$list-group-variant-color: shift-color($value, $list-group-item-color-scale);
@if (contrast-ratio($list-group-variant-bg, $list-group-variant-color) < $min-contrast-ratio) {
$list-group-variant-color: mix($value, color-contrast($list-group-variant-bg), abs($list-group-item-color-scale));
}
@include list-group-item-variant($state, $list-group-variant-bg, $list-group-variant-color);
}
Okuddamu
Zino Sass loops tezikoma ku maapu za langi zokka, era. Osobola n’okukola enjawulo eziddamu ez’ebitundu byo. Twala okugeza responsive alignment yaffe eya dropdowns gye tutabula @each
loop ya $grid-breakpoints
Sass map ne media query include.
// We deliberately hardcode the `bs-` prefix because we check
// this custom property in JS to determine Popper's positioning
@each $breakpoint in map-keys($grid-breakpoints) {
@include media-breakpoint-up($breakpoint) {
$infix: breakpoint-infix($breakpoint, $grid-breakpoints);
.dropdown-menu#{$infix}-start {
--bs-position: start;
&[data-bs-popper] {
right: auto;
left: 0;
}
}
.dropdown-menu#{$infix}-end {
--bs-position: end;
&[data-bs-popper] {
right: 0;
left: auto;
}
}
}
}
Singa okyusa $grid-breakpoints
, enkyukakyuka zo zijja kukola ku loopu zonna eziddiŋŋana ku maapu eyo.
$grid-breakpoints: (
xs: 0,
sm: 576px,
md: 768px,
lg: 992px,
xl: 1200px,
xxl: 1400px
);
Okumanya ebisingawo n’ebyokulabirako ku ngeri y’okukyusaamu maapu zaffe eza Sass n’enkyukakyuka, laba ekitundu kya Sass eky’ebiwandiiko bya Grid .
Okutondawo ebibyo
Tukukubiriza okwettanira enkola zino nga ozimba ne Bootstrap okukola ebitundu byo. Enkola eno tugigaziyizza ffekka ku bitundu eby’ennono mu biwandiiko byaffe n’ebyokulabirako. Ebitundu nga callouts zaffe bizimbibwa nga ebitundu byaffe bye tuwadde nga biriko base ne modifier classes.
<div class="callout">...</div>
Mu CSS yo, wandibadde n'ekintu nga kino wammanga nga ekitundu ekinene eky'okukola sitayiro kikolebwa nga kiyita mu .callout
. Olwo, emisono egy’enjawulo wakati wa buli nkyukakyuka efugibwa okuyita mu kiraasi y’omukyusa.
// Base class
.callout {}
// Modifier classes
.callout-info {}
.callout-warning {}
.callout-danger {}
Ku callouts, eyo sitayiro ey’enjawulo eba ya border-left-color
. Bw’ogatta ekibiina ekyo eky’omusingi n’ekimu ku kiraasi ezo ezikyusa, ofuna famire yo ey’ebitundu enzijuvu: