Tīpoka ki te ihirangi matua Tīpoka ki te whakaterenga tuhinga
in English

Waehanga

Akohia me pehea te hanga me te aha tatou e hanga tata ana i a tatou waahanga katoa ma te whakautu me nga karaehe turanga me te whakarereke.

Nga karaehe turanga

Ko nga waahanga o Bootstrap te nuinga o te hanga me te whakaingoa ingoa-whakarereke. Ka whakarōpūhia e matou te maha o nga taonga tiritahi ka taea ki roto i te karaehe turanga, penei .btni te , ka whakarōpū i nga momo momo takitahi mo ia momo rereke ki nga karaehe whakarereke, penei .btn-primaryme te .btn-success.

Hei hanga i a maatau karaehe whakarereke, ka whakamahia e matou nga @eachkoropiko a Sass ki te huri i runga i te mapi Sass. He tino awhina tenei mo te whakaputa rereke o tetahi waahanga ma o maatau $theme-colorsme te hanga rereke urupare mo ia waahi pakaru. I a koe e whakarite ana i enei mapi Sass me te whakahiato ano, ka kite koe i o huringa ka kitea i roto i enei koropiko.

Tirohia o maatau mapi Sass me nga tuhinga loops mo te whakarite i enei koropiko me te whakawhānui i te huarahi whakarereke-turanga a Bootstrap ki to ake waehere.

Whakarerekē

He maha nga waahanga o Bootstrap i hangaia me te huarahi akomanga-whakarereke. Ko te tikanga ko te nuinga o te whakaahua kei roto i te karaehe turanga (hei tauira, .btn) engari ko nga momo rerekee ka herea ki nga karaehe whakarereke (hei tauira, .btn-danger). Ko enei karaehe whakarereke i hangaia mai i te $theme-colorsmapi hei whakarite i te nama me te ingoa o a maatau akomanga whakarereke.

Anei nga tauira e rua mo te hurihanga i runga i te $theme-colorsmapi ki te whakaputa whakarereke ki nga waahanga .alertme nga .list-groupwaahanga.

// 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);
}

Whakautu

Ko enei koropiko Sass ehara i te mea iti ki nga mapi tae. Ka taea hoki e koe te whakaputa i nga rereketanga urupare o o waahanga. Hei tauira, ko ta maatau whakahāngaitanga o nga takahanga kei reira ka whakakotahihia e matou he @eachkowiri mo te $grid-breakpointsmapi Sass me tetahi patai pāpāho kei roto.

// 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;
      }
    }
  }
}

Mena ka whakarereke koe i to $grid-breakpoints, ka pa nga huringa ki nga koropiko katoa e huri haere ana i runga i taua mapi.

$grid-breakpoints: (
  xs: 0,
  sm: 576px,
  md: 768px,
  lg: 992px,
  xl: 1200px,
  xxl: 1400px
);

Mo etahi atu korero me nga tauira mo te whakarereke i o maatau mahere Sass me nga taurangi, tirohia te waahanga Sass o te tuhinga Matiti .

Te hanga i a koe ake

Ka akiaki matou ki a koe ki te tango i enei aratohu i te wa e hanga ana me Bootstrap hei hanga i a koe ake waahanga. Kua whakawhānuihia e matou tenei huarahi ki nga waahanga ritenga i roto i a maatau tuhinga me nga tauira. Ko nga waahanga penei i a maatau waea ka hangaia kia rite ki o maatau waahanga kua whakaratohia me nga karaehe turanga me te whakarereke.

He karangatanga tenei. I hangaia e matou he tikanga mo o maatau tuhinga kia tu mai a matou karere ki a koe. E toru nga momo rereke ma nga karaehe whakarereke.
<div class="callout">...</div>

I roto i to CSS, kei a koe tetahi mea penei e whai ake nei kei te mahia te nuinga o te hanga ma te .callout. Na, ko nga momo ahurei i waenga i ia momo rereke ka whakahaerehia ma te akomanga whakarereke.

// Base class
.callout {}

// Modifier classes
.callout-info {}
.callout-warning {}
.callout-danger {}

Mo nga karangatanga, ko taua ahua ahurei he border-left-color. Ka whakakotahihia e koe taua karaehe turanga me tetahi o aua karaehe whakarereke, ka whiwhi koe i to whanau waahanga katoa:

He korero korero tenei. He tauira kuputuhi hei whakaatu i te mahi.
He karanga whakatupato tenei. He tauira kuputuhi hei whakaatu i te mahi.
He piiraa morearea tenei. He tauira kuputuhi hei whakaatu i te mahi.