Source

Sib nrug

Bootstrap suav nrog ntau yam ntawm cov lus teb luv luv thiab cov chav kawm siv hluav taws xob padding los hloov kho lub ntsiab lus.

Nws ua haujlwm li cas

Muab cov lus teb-phooj ywg marginlos yog paddingqhov tseem ceeb rau ib lub ntsiab lus lossis ib pawg ntawm nws sab nrog cov chav kawm luv. Xws li kev txhawb nqa rau cov khoom ntiag tug, txhua yam khoom, thiab cov khoom ntsug thiab kab rov tav. Cov chav kawm yog tsim los ntawm lub neej ntawd Sass daim ntawv qhia xws li .25remmus rau 3rem.

Lus cim

Cov khoom siv sib cais uas siv rau txhua qhov kev sib cais, los ntawm xsmus rau xl, tsis muaj qhov luv luv ntawm lawv. Qhov no yog vim tias cov chav kawm no tau siv los ntawm min-width: 0thiab nce, thiab yog li tsis muaj kev cuam tshuam los ntawm kev nug xov xwm. Cov seem breakpoints, txawm li cas los xij, suav nrog cov luv luv breakpoint.

Cov chav kawm muaj npe siv hom ntawv {property}{sides}-{size}rau xsthiab {property}{sides}-{breakpoint}-{size}rau sm, md, lg, thiab xl.

Qhov twg khoom yog ib qho ntawm:

  • m- rau cov chav kawm uas teemmargin
  • p- rau cov chav kawm uas teempadding

Qhov twg sab yog ib qho ntawm:

  • t- rau cov chav kawm uas teem margin-toplos yogpadding-top
  • b- rau cov chav kawm uas teem margin-bottomlos yogpadding-bottom
  • l- rau cov chav kawm uas teem margin-leftlos yogpadding-left
  • r- rau cov chav kawm uas teem margin-rightlos yogpadding-right
  • x- rau cov chav kawm uas teem ob qho tib si *-leftthiab*-right
  • y- rau cov chav kawm uas teem ob qho tib si *-topthiab*-bottom
  • dawb paug - rau cov chav kawm uas teem ib marginlos yog paddingtag nrho 4 sab ntawm lub caij

Qhov loj me yog ib qho ntawm:

  • 0- rau cov chav kawm uas tshem tawm marginlossis paddinglos ntawm kev teeb tsa0
  • 1- (los ntawm lub neej ntawd) rau cov chav kawm uas teeb tsa marginlossis paddingrau$spacer * .25
  • 2- (los ntawm lub neej ntawd) rau cov chav kawm uas teeb tsa marginlossis paddingrau$spacer * .5
  • 3- (los ntawm lub neej ntawd) rau cov chav kawm uas teeb tsa marginlossis paddingrau$spacer
  • 4- (los ntawm lub neej ntawd) rau cov chav kawm uas teeb tsa marginlossis paddingrau$spacer * 1.5
  • 5- (los ntawm lub neej ntawd) rau cov chav kawm uas teeb tsa marginlossis paddingrau$spacer * 3
  • auto- rau cov chav kawm uas teem marginrau auto

(Koj tuaj yeem ntxiv qhov ntau thiab tsawg los ntawm kev ntxiv nkag rau $spacersSass daim ntawv qhia hloov pauv.)

Piv txwv

Nov yog qee qhov piv txwv ntawm cov chav kawm no:

.mt-0 {
  margin-top: 0 !important;
}

.ml-1 {
  margin-left: ($spacer * .25) !important;
}

.px-2 {
  padding-left: ($spacer * .5) !important;
  padding-right: ($spacer * .5) !important;
}

.p-3 {
  padding: $spacer !important;
}

Kab rov tav centering

Tsis tas li ntawd, Bootstrap tseem suav nrog cov .mx-autochav kawm rau kab rov tav nruab nrab qhov dav-dav thaiv cov ntsiab lus - uas yog, cov ntsiab lus uas muaj display: blockthiab widthteeb tsa - los ntawm kev teeb tsa cov kab rov tav rau auto.

Lub ntsiab tseem ceeb
<div class="mx-auto" style="width: 200px;">
  Centered element
</div>