in English

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 . Midziyo inoshandiswa kuve ne, pad, uye (dzimwe nguva) pakati pezviri mukati mazvo. Nepo midziyo inogona kuvharirwa, marongerwo mazhinji haadi chigadziko chine madendere.

Bootstrap inouya nemidziyo mitatu yakasiyana:

  • .container, iyo inoisa max-widthpane imwe neimwe inopindura breakpoint
  • .container-fluid, iyo iri width: 100%panguva dzese dzekutyora
  • .container-{breakpoint}, inova width: 100%kusvika pane yakatarwa breakpoint

Tafura iri pazasi inoratidza kuti mudziyo wega wega max-widthunofananidzwa sei neyekutanga .containeruye .container-fluidpadanho rega rega rekutyora.

Vaone mukuita uye vaenzanise muGridhi yedu muenzaniso .

Yakawedzera diki
<576px
Diki ≥576px
Pakati
nepakati ≥768px
Huru ≥992px
Yakawedzera hombe
≥1200px
.container 100% 540px 720px 960px 1140px
.container-sm 100% 540px 720px 960px 1140px
.container-md 100% 100% 720px 960px 1140px
.container-lg 100% 100% 100% 960px 1140px
.container-xl 100% 100% 100% 100% 1140px
.container-fluid 100% 100% 100% 100% 100%

Zvese pamwechete

Yedu .containeryakasarudzika kirasi inopindura, yakagadziriswa-yakafara mudziyo, zvichireva max-widthshanduko dzayo pane imwe neimwe breakpoint.

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

Fluid

Shandisa .container-fluidkune chigadziko chakazara chakafara, chinotenderera hupamhi hwese hwekutarisa.

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

Anoteerera

Anopindura midziyo mitsva muBootstrap v4.4. Ivo vanokutendera kuti utaure kirasi iyo iri 100% yakafara kusvika iyo yakatarwa breakpoint yasvika, mushure mezvo isu tinoisa max-widths kune imwe neimwe yepamusoro breakpoints. Semuyenzaniso, .container-smi100% yakafara kutanga kusvika pasvika nzvimbo smyekuputsika, painozokwira ne md, lg, uye xl.

<div class="container-sm">100% wide until small breakpoint</div>
<div class="container-md">100% wide until medium breakpoint</div>
<div class="container-lg">100% wide until large breakpoint</div>
<div class="container-xl">100% wide until extra large breakpoint</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 mafaera eSass 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.