Hla mus rau cov ntsiab lus tseem ceeb Hla mus rau docs navigation
Check
in English

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 xxl, 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, thiab xxl.

Qhov twg tus nqi yog ib qho ntawm:

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

Cov zaub muaj txiaj ntsig tuaj yeem hloov pauv los ntawm kev hloov cov displaytxiaj ntsig tau teev tseg hauv $utilitiesthiab rov ua dua SCSS.

Cov lus nug xov xwm cuam tshuam rau qhov dav dav ntawm lub vijtsam nrog rau qhov muab ncua lossis loj dua . Piv txwv li, .d-lg-noneteem display: none;rau lg, xl, thiab xxlcov ntxaij vab tshaus.

Piv txwv

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

Nthuav cov ntsiab lus

Rau kev txhim kho mobile-phooj ywg sai dua, siv cov chav qhia 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,xxl}-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-none .d-xxl-noneyuav zais cov khoom rau txhua qhov screen loj tshwj tsis yog cov khoom siv nruab nrab thiab loj.

Screen 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
Muab zais rau ntawm xxl .d-xxl-none .d-xxl-block
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 .d-xxl-none
Pom tau tsuas yog ntawm xxl .d-none .d-xxl-block
nkaum ntawm lg thiab wider screen
nkaum ntawm cov ntxaij vab tshaus me dua lg
html
<div class="d-lg-none">hide on lg and wider screens</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 chav luam ntawv cov khoom siv hluav taws xob. suav nrog kev txhawb nqa rau tib displayqhov txiaj ntsig raws li peb cov .d-*khoom siv ua haujlwm.

  • .d-print-none
  • .d-print-inline
  • .d-print-inline-block
  • .d-print-block
  • .d-print-grid
  • .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)
Sau nkaus xwb (Hide on screen only)
Nkaum mus txog qhov loj ntawm qhov screen, tab sis ib txwm pom ntawm luam
html
<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>

Sass

Utilities API

Cov khoom siv tso saib tau tshaj tawm hauv peb cov khoom siv hluav taws xob API hauv scss/_utilities.scss. Kawm paub siv cov khoom siv hluav taws xob API li cas.

    "display": (
      responsive: true,
      print: true,
      property: display,
      class: d,
      values: inline inline-block block grid table table-row table-cell flex inline-flex none
    ),