Source

Tso cov cuab yeej

Ceev ceev thiab teb toggle tus nqi zaub ntawm cov khoom thiab ntau ntxiv nrog peb cov khoom siv tso saib. Xws li kev txhawb nqa rau qee qhov txiaj ntsig ntau dua, nrog rau qee qhov ntxiv rau kev tswj cov zaub thaum luam ntawv.

Nws ua haujlwm li cas

Hloov tus nqi ntawm cov displaycuab yeej nrog peb cov chav kawm siv hluav taws xob ua haujlwm. Peb lub hom phiaj txhawb nqa tsuas yog ib feem ntawm tag nrho cov txiaj ntsig ua tau rau display. Cov chav kawm tuaj yeem ua ke rau ntau yam teebmeem raws li koj xav tau.

Lus cim

Tso cov chav kawm siv hluav taws xob uas siv rau txhua qhov kev sib cais , los ntawm xsqhov xl, tsis muaj qhov luv luv ntawm lawv. Qhov no yog vim tias cov chav kawm no tau siv los ntawm min-width: 0;thiab 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.

Yog li ntawd, cov chav kawm muaj npe siv hom ntawv:

  • .d-{value}rauxs
  • .d-{breakpoint}-{value}rau sm, md, lg, xl.

Qhov twg tus nqi yog ib qho ntawm:

  • none
  • inline
  • inline-block
  • block
  • table
  • table-cell
  • table-row
  • flex
  • inline-flex

Cov lus nug xov xwm cuam tshuam qhov screen dav nrog rau qhov muab breakpoint lossis loj dua . Piv txwv li, .d-lg-noneteeb tsa display: none;ntawm ob qho tib si lgthiab xlcov ntxaij vab tshaus.

Piv txwv

d-inline ua
d-inline ua
<div class="d-inline p-2 bg-primary text-white">d-inline</div>
<div class="d-inline p-2 bg-dark text-white">d-inline</div>
d-block d-block
<span class="d-block p-2 bg-primary text-white">d-block</span>
<span class="d-block p-2 bg-dark text-white">d-block</span>

Nthuav cov ntsiab lus

Rau kev txhim kho mobile-phooj ywg sai dua, siv cov chav kawm ua haujlwm rau kev qhia thiab zais cov ntsiab lus los ntawm lub cuab yeej. Tsis txhob tsim cov qauv sib txawv ntawm tib lub xaib, es tsis txhob zais cov ntsiab lus teb rau txhua qhov screen loj.

Txhawm rau nkaum cov ntsiab lus tsuas yog siv cov .d-nonechav kawm lossis ib qho ntawm cov .d-{sm,md,lg,xl}-nonechav kawm rau txhua qhov kev hloov pauv ntawm lub vijtsam.

Txhawm rau qhia ib lub caij tsuas yog nyob rau ib ntus ntawm qhov ntau thiab tsawg ntawm qhov screen koj tuaj yeem ua ke ib .d-*-nonechav kawm nrog ib .d-*-*chav kawm, piv txwv li .d-none .d-md-block .d-xl-noneyuav zais cov khoom rau txhua qhov screen loj tshwj tsis yog cov khoom siv nruab nrab thiab loj.

Qhov Loj Chav kawm
Muab zais rau txhua tus .d-none
Muab zais rau ntawm xs .d-none .d-sm-block
Muab zais rau ntawm sm .d-sm-none .d-md-block
Muab zais rau ntawm md .d-md-none .d-lg-block
Muab zais rau ntawm lg .d-lg-none .d-xl-block
Muab zais rau ntawm xl .d-xl-none
Pom tau ntawm txhua tus .d-block
Pom tau tsuas yog ntawm xs .d-block .d-sm-none
Pom tau tsuas yog ntawm sm .d-none .d-sm-block .d-md-none
Pom tau tsuas yog ntawm md .d-none .d-md-block .d-lg-none
Pom tau tsuas yog ntawm lg .d-none .d-lg-block .d-xl-none
Pom tau tsuas yog ntawm xl .d-none .d-xl-block
hide on screens wider than lg
nkaum ntawm cov ntxaij vab tshaus me dua lg
<div class="d-lg-none">hide on screens wider than lg</div>
<div class="d-none d-lg-block">hide on screens smaller than lg</div>

Muab tso rau hauv luam tawm

Hloov tus displaynqi ntawm cov ntsiab lus thaum luam ntawv nrog peb cov ntawv luam tawm cov khoom siv hluav taws xob. Xws li kev txhawb nqa rau cov displaytxiaj ntsig zoo ib yam li peb cov .d-*khoom siv ua haujlwm.

  • .d-print-none
  • .d-print-inline
  • .d-print-inline-block
  • .d-print-block
  • .d-print-table
  • .d-print-table-row
  • .d-print-table-cell
  • .d-print-flex
  • .d-print-inline-flex

Cov chav kawm luam tawm thiab tso saib tuaj yeem ua ke.

Screen nkaus xwb (Hide on print only)
Print Only (Hide on screen only)
Nkaum mus txog qhov loj ntawm qhov screen, tab sis ib txwm pom ntawm luam
<div class="d-print-none">Screen Only (Hide on print only)</div>
<div class="d-none d-print-block">Print Only (Hide on screen only)</div>
<div class="d-none d-lg-block d-print-block">Hide up to large on screen, but always show on print</div>