Source

Ro-shealladh

Co-phàirtean agus roghainnean airson do phròiseact Bootstrap a dhealbhadh, a’ toirt a-steach soithichean pasgadh, siostam clèithe cumhachdach, rud meadhanan sùbailte, agus clasaichean goireasach freagairteach.

Gabhadairean

Is e soithichean an eileamaid cruth as bunaitiche ann am Bootstrap agus tha feum orra nuair a bhios tu a’ cleachdadh ar siostam clèithe bunaiteach . Tagh bho shoitheach freagairteach, leud stèidhichte (a’ ciallachadh na h- max-widthatharrachaidhean aige aig gach briseadh) no leud siùbhlach (a ’ciallachadh gu bheil e 100%farsaing fad na h-ùine).

Ged a dh’ fhaodar soithichean a neadachadh, chan fheum a’ mhòr-chuid de chruthan soitheach neadachaidh.

<div class="container">
  <!-- Content here -->
</div>

Cleachd .container-fluidairson soitheach làn leud, a ’spangachadh leud iomlan a’ phuirt-seallaidh.

<div class="container-fluid">
  ...
</div>

Puingean brisidh freagairteach

Leis gu bheil Bootstrap air a leasachadh gus a bhith gluasadach an toiseach, bidh sinn a’ cleachdadh dòrlach de cheistean meadhanan gus puingean brisidh ciallach a chruthachadh airson ar cruth agus ar eadar-aghaidh. Tha na puingean brisidh sin stèidhichte sa mhòr-chuid air an leud as lugha de shealladh-seallaidh agus leigidh sinn leinn eileamaidean a mheudachadh mar a bhios am port-seallaidh ag atharrachadh.

Bidh Bootstrap gu sònraichte a’ cleachdadh na raointean ceist meadhanan a leanas - no puingean brisidh - anns na faidhlichean Sass stòr againn airson ar cruth, siostam clèithe, agus co-phàirtean.

// Extra 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) { ... }

// Extra large devices (large desktops, 1200px and up)
@media (min-width: 1200px) { ... }

Leis gu bheil sinn a’ sgrìobhadh an stòr CSS againn ann an Sass, tha na ceistean meadhanan againn uile rim faighinn tro Sass 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) { ... }

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

Bidh sinn uaireannan a’ cleachdadh cheistean meadhanan a thèid an taobh eile (am meud sgrion a chaidh a thoirt seachad no nas lugha ):

// Extra small devices (portrait phones, less than 576px)
@media (max-width: 575.98px) { ... }

// Small devices (landscape phones, less than 768px)
@media (max-width: 767.98px) { ... }

// Medium devices (tablets, less than 992px)
@media (max-width: 991.98px) { ... }

// Large devices (desktops, less than 1200px)
@media (max-width: 1199.98px) { ... }

// Extra large devices (large desktops)
// No media query since the extra-large breakpoint has no upper bound on its width

Thoir an aire, leis nach eil brobhsairean a’ toirt taic do cheistean co-theacsa raon an-dràsta , bidh sinn ag obair timcheall air crìochan min-agus max-ro -leasachan agus puirt seallaidh le leudan bloighteach (a dh’ fhaodadh tachairt fo chumhachan sònraichte air innealan àrd-dpi, mar eisimpleir) le bhith a’ cleachdadh luachan le mionaideachd nas àirde airson na coimeasan sin. .

A-rithist, tha na ceistean meadhanan seo rim faighinn cuideachd tro Sass mixins:

@include media-breakpoint-down(xs) { ... }
@include media-breakpoint-down(sm) { ... }
@include media-breakpoint-down(md) { ... }
@include media-breakpoint-down(lg) { ... }
// No media query necessary for xl breakpoint as it has no upper bound on its width

// Example: Style from medium breakpoint and down
@include media-breakpoint-down(md) {
  .custom-class {
    display: block;
  }
}

Tha ceistean meadhanan agus measgachadh ann cuideachd airson a bhith ag amas air aon roinn de mheudan sgrion a’ cleachdadh an leud as ìsle agus as àirde.

// Extra small devices (portrait phones, less than 576px)
@media (max-width: 575.98px) { ... }

// Small devices (landscape phones, 576px and up)
@media (min-width: 576px) and (max-width: 767.98px) { ... }

// Medium devices (tablets, 768px and up)
@media (min-width: 768px) and (max-width: 991.98px) { ... }

// Large devices (desktops, 992px and up)
@media (min-width: 992px) and (max-width: 1199.98px) { ... }

// Extra large devices (large desktops, 1200px and up)
@media (min-width: 1200px) { ... }

Tha na ceistean meadhanan seo rim faighinn cuideachd tro Sass mixins:

@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) { ... }

San aon dòigh, faodaidh ceistean meadhanan a dhol thairis air grunn leudan brisidh:

// Example
// Apply styles starting from medium devices and up to extra large devices
@media (min-width: 768px) and (max-width: 1199.98px) { ... }

Is e am measgachadh Sass airson a bhith ag amas air an aon raon meud sgrion:

@include media-breakpoint-between(md, xl) { ... }

Z-clàr-amais

Bidh grunn phàirtean Bootstrap a’ cleachdadh z-index, an togalach CSS a chuidicheas le smachd a chumail air cruth le bhith a’ toirt seachad treas axis gus susbaint a chuir air dòigh. Bidh sinn a’ cleachdadh sgèile clàr-z bunaiteach ann am Bootstrap a chaidh a dhealbhadh gus seòladh, molaidhean innealan agus popovers, modalan agus barrachd a chòmhdach gu ceart.

Bidh na luachan nas àirde sin a’ tòiseachadh aig àireamh neo-riaghailteach, àrd agus sònraichte gu leòr gus còmhstrithean a sheachnadh. Feumaidh sinn seata àbhaisteach dhiubh sin thairis air na co-phàirtean sreathach againn - molaidhean innealan, popovers, navbars, dropdowns, modalan - gus an urrainn dhuinn a bhith reusanta cunbhalach nar giùlan. Chan eil adhbhar sam bith nach b’ urrainn dhuinn a bhith air 100+ no + a chleachdadh 500.

Cha bhith sinn a’ brosnachadh gnàthachadh nan luachan fa leth sin; ma dh'atharraicheas tu fear, is dòcha gum feum thu iad uile atharrachadh.

$zindex-dropdown:          1000 !default;
$zindex-sticky:            1020 !default;
$zindex-fixed:             1030 !default;
$zindex-modal-backdrop:    1040 !default;
$zindex-modal:             1050 !default;
$zindex-popover:           1060 !default;
$zindex-tooltip:           1070 !default;

Gus dèiligeadh ri crìochan thar-tharraingeach taobh a-staigh phàirtean (me, putanan agus cuir a-steach ann am buidhnean cuir a-steach), bidh sinn a’ cleachdadh z-indexluachan aon-fhigearach ìosal de 1, 2, agus 3airson stàitean bunaiteach, hover, agus gnìomhach. Air hover/fòcas/gnìomhach, bidh sinn a’ toirt eileamaid shònraichte air thoiseach le z-indexluach nas àirde gus a’ chrìoch aca a shealltainn thairis air na h-eileamaidean sibling.