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 display
cuab 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 xs
qhov 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}
rausm
,md
,lg
,xl
, thiabxxl
.
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 pauv qhov $displays
sib txawv thiab 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-none
teem display: none;
rau lg
, xl
, thiab xxl
cov ntxaij vab tshaus.
Piv txwv
<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>
<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-none
chav kawm lossis ib qho ntawm cov .d-{sm,md,lg,xl,xxl}-none
chav kawm rau txhua qhov kev hloov pauv ntawm lub vijtsam.
Txhawm rau qhia ib lub ntsiab lus tsuas yog nyob rau ib ntus ntawm qhov ntau thiab tsawg ntawm qhov screen koj tuaj yeem ua ke ib .d-*-none
chav kawm nrog ib .d-*-*
chav kawm, piv txwv li .d-none .d-md-block .d-xl-none .d-xxl-none
yuav 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 .d-xxl-block |
Muab zais rau ntawm xxl | .d-xxl-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 .d-xxl-none |
Pom tau tsuas yog ntawm xxl | .d-none .d-xxl-block |
<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 display
nqi 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 display
qhov 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.
<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
),