Source

Overview

Zvikamu uye sarudzo dzekuisa yako Bootstrap purojekiti, kusanganisira yekuputira midziyo, ine simba gidhi system, inoshanduka midhiya chinhu, uye inopindura zvekushandisa makirasi.

Containers

Containers ndiyo inonyanya kukosha dhizaini muBootstrap uye inodiwa kana uchishandisa yedu default grid system . Sarudza kubva mumudziyo unopindura, wakagadzika-wakafara (zvichireva max-widthshanduko dzayo panzvimbo yega yega) kana fluid-width (zvinoreva kuti 100%yakakura nguva dzese).

Nepo midziyo inogona kuvharirwa, marongerwo mazhinji haadi chigadziko chine madendere.

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

Shandisa .container-fluidkune yakazara hupamhi chigaba, chinotenderera hupamhi hwese hwekutarisa.

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

Responsive breakpoints

Sezvo Bootstrap yakagadziridzwa kuti ive mbozha yekutanga, isu tinoshandisa mishoma yemibvunzo midhiya kugadzira inonzwisisika yekutyora kwemaitiro edu uye mainterface. Aya mabreakpoints anonyanya kuve akavakirwa pane mashoma ekutarisa upamhi uye anotibvumira kukwira kumusoro zvinhu sekuchinja kwekutarisa.

Bootstrap inonyanya kushandisa iyo inotevera midhiya yemubvunzo marenji-kana breakpoints-mune yedu sosi maSass mafaera edhizaini yedu, grid system, uye zvikamu.

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

Sezvo isu tichinyora yedu sosi CSS muSass, yedu yese midhiya mibvunzo inowanikwa kuburikidza neSass musanganiswa:

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

Isu dzimwe nguva tinoshandisa midhiya mibvunzo inoenda kune rimwe divi (iyo yakapihwa skrini saizi kana diki ):

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

Ziva kuti sezvo mabhurawuza pari zvino asingatsigire mivhunzo yezvimiro , isu tinoshanda zvakatenderedza min-uye max-prefixes uye nzvimbo dzekutarisa dzine hupamhi hwakaganhurwa (izvo zvinogona kuitika mune mamwe mamiriro pamichina yepamusoro-dpi, semuenzaniso) nekushandisa hunhu nehunyanzvi hwepamusoro pakuenzanisa uku. .

Zvekare, iyi midhiya mibvunzo inowanikwawo kuburikidza neSass musanganiswa:

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

Kune zvakare midhiya mibvunzo uye musanganiswa wekunongedza chikamu chimwe chete chehukuru hwescreen uchishandisa hudiki uye hwakanyanya breakpoint upamhi.

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

Iyi midhiya mibvunzo inowanikwawo kuburikidza neSass musanganiswa:

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

Saizvozvo, midhiya mibvunzo inogona kureba akawanda breakpoint wides:

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

Iyo Sass musanganiswa wekutarisa yakafanana skrini saizi renji ingave:

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

Z-index

Zvinoverengeka zveBootstrap zvinoshandisa z-index, iyo CSS pfuma inobatsira kudzora marongero nekupa yechitatu axis kuronga zvirimo. Isu tinoshandisa yakasarudzika z-index chiyero muBootstrap iyo yakagadzirirwa kunyatso kurongedza kufamba, matipi ezvishandiso uye popovers, modal, nezvimwe.

Hunhu hwepamusoro uhwu hunotanga panhamba isingaverengeki, yakakwirira uye yakananga zvakakwana kudzivirira kunetsana. Tinoda yakajairwa seti yeizvi mukati mezvikamu zvedu zvakaturikidzana-zvishandiso, popovers, navbars, dropdowns, modals-kuti tigone kuenderana mune maitiro. Hapana chikonzero chatingadai tisina kushandisa 100+ kana 500+.

Hatikurudzire kugadziridzwa kwetsika dzemunhu idzi; kana ukachinja imwe chete, ungangoda kuichinja ese.

$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;

Kubata mabhodha anodhumhana mukati mezvikamu (semu, mabhatani nezvinoiswa mumapoka ekuisa), tinoshandisa yakaderera manhamba z-indexma values ​​e 1, 2, uye 3kune default , hover, uye inoshanda matunhu. Pane hover/focus/active, tinounza chimwe chinhu kumberi chine z-indexkukosha kwepamusoro kuratidza muganho wavo pamusoro pezvinhu zvehama.