in English

Forbhreathnú

Comhpháirteanna agus roghanna chun do thionscadal Bootstrap a leagan amach, lena n-áirítear coimeádáin timfhilleadh, córas eangaí cumhachtach, réad meán solúbtha, agus ranganna fóntais sofhreagracha.

Coimeádáin

Is iad na coimeádáin an leagan amach is bunúsaí i Bootstrap agus bíonn siad ag teastáil agus ár gcóras greille réamhshocraithe á úsáid againn . Úsáidtear coimeádáin chun an t-ábhar laistigh díobh a choinneáil, a stuáil, agus (uaireanta) a lárú. Cé gur féidir coimeádáin a neadú, ní bhíonn coimeádán neadaithe de dhíth ar fhormhór na leagan amach.

Tagann bootstrap le trí choimeádán éagsúla:

  • .container, a leagann síos max-widthag gach brisphointe sofhreagrach
  • .container-fluid, atá width: 100%ar gach brisphointe
  • .container-{breakpoint}, is é sin width: 100%go dtí an brisphointe sonraithe

Léiríonn an tábla thíos conas a chuirtear gach coimeádán i max-widthgcomparáid leis an mbunphointe .containeragus .container-fluidtrasna gach brisphointe.

Féach orthu i mbun gnímh agus cuir i gcomparáid iad inár sampla Eangaí .

Beag breise
<576px
Beag
≥576px
Meánach
≥768px
Mór
≥992px
Mór breise
≥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%

I dteannta a chéile

.containerIs coimeádán sofhreagrach, leithead seasta é ár rang réamhshocraithe , rud a chiallaíonn a chuid max-widthathruithe ag gach brisphointe.

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

Sreabhán

Bain úsáid as .container-fluidle haghaidh coimeádán leithead iomlán, a chuimsíonn leithead iomlán an amhairc.

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

Sofhreagrach

Tá coimeádáin sofhreagracha nua i Bootstrap v4.4. Ligeann siad duit aicme a shonrú atá 100% ar leithead go dtí go mbaintear an brisphointe sonraithe amach, agus ina dhiaidh sin cuirimid max-widths i bhfeidhm ar gach ceann de na brisphointí is airde. Mar shampla, .container-sman bhfuil 100% ar leithead le tosú go dtí go sroichfear an smbrisphointe, áit a méadóidh sé le md, lg, agus 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>

Brisphointí sofhreagracha

Ós rud é go bhforbraítear Bootstrap le bheith soghluaiste ar dtús, bainimid úsáid as dornán fiosrúchán ó na meáin chun brisphointí ciallmhara a chruthú dár leagan amach agus dár gcomhéadain. Tá na brisphointí seo bunaithe den chuid is mó ar íosleithead an amhairc agus ligeann siad dúinn gnéithe a mhéadú de réir mar a athraíonn an radharc.

Úsáideann Bootstrap go príomha na raonta fiosrúcháin meán seo a leanas - nó brisphointí - inár gcomhaid fhoinse Sass dár leagan amach, córas greille agus comhpháirteanna.

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

Ós rud é go scríobhaimid ár bhfoinse CSS i Sass, tá ár bhfiosruithe ó na meáin go léir ar fáil trí 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;
  }
}

Ó am go chéile úsáidimid fiosruithe ó na meáin a théann sa treo eile (an méid scáileáin tugtha nó níos lú ):

// 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
Tabhair faoi deara ós rud é nach dtacaíonn brabhsálaithe le fiosruithe comhthéacs raoin faoi láthair , oibrímid timpeall ar na teorainneacha min-agus na max-réimíreanna agus na hamharcphointí le leithead codánach (is féidir a bheith ann faoi choinníollacha áirithe ar ghléasanna ard-spásanna, mar shampla) trí luachanna le cruinneas níos airde a úsáid le haghaidh na gcomparáidí seo .

Arís eile, tá na ceisteanna seo ó na meáin ar fáil freisin trí 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;
  }
}

Tá ceisteanna agus meascáin ó na meáin ann freisin chun díriú ar theascán amháin de mhéideanna scáileáin ag baint úsáide as na híosleithead agus na uasleithead briste.

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

Tá na ceisteanna seo ó na meáin ar fáil freisin trí 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) { ... }

Mar an gcéanna, d’fhéadfadh ceisteanna ó na meáin chumarsáide a bheith i gceist le hilphointí briste:

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

Is é an meascán Sass chun díriú ar an raon céanna méid scáileáin ná:

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

Z-innéacs

Úsáideann go leor comhpháirteanna Bootstrap z-index, an t-airí CSS a chuidíonn le leagan amach a rialú trí thríú ais a sholáthar chun ábhar a shocrú. Bainimid úsáid as scála réamhshocraithe z-innéacs i Bootstrap atá deartha chun an loingseoireacht, leideanna uirlisí agus popovers, módúil agus go leor eile a chisealú i gceart.

These higher values start at an arbitrary number, high and specific enough to ideally avoid conflicts. We need a standard set of these across our layered components—tooltips, popovers, navbars, dropdowns, modals—so we can be reasonably consistent in the behaviors. There’s no reason we couldn’t have used 100+ or 500+.

We don’t encourage customization of these individual values; should you change one, you likely need to change them all.

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

To handle overlapping borders within components (e.g., buttons and inputs in input groups), we use low single digit z-index values of 1, 2, and 3 for default, hover, and active states. On hover/focus/active, we bring a particular element to the forefront with a higher z-index value to show their border over the sibling elements.