Iqhekeza lesonka
Bonisa indawo yephepha langoku ngaphakathi koluhlu lolawulo lolwandle olongeza ngokuzenzekelayo izahluli ngeCSS.
Umzekelo
Sebenzisa uluhlu olucwangcisiweyo okanye olungacwangciswanga olunezinto zoluhlu oludityanisiweyo ukwenza i-breadcrumb enesitayile esincinci. Sebenzisa izixhobo zethu ukongeza izitayile ezongezelelweyo njengoko ufuna.
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
<li class="breadcrumb-item active" aria-current="page">Home</li>
</ol>
</nav>
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="#">Home</a></li>
<li class="breadcrumb-item active" aria-current="page">Library</li>
</ol>
</nav>
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="#">Home</a></li>
<li class="breadcrumb-item"><a href="#">Library</a></li>
<li class="breadcrumb-item active" aria-current="page">Data</li>
</ol>
</nav>
Abahluli
Izahluli zongezwa ngokuzenzekelayo kwiCSS ::before
nge content
. Zingatshintshwa ngokuguqula ipropathi yendawo yeCSS yendawo --bs-breadcrumb-divider
, okanye ngokusebenzisa i- $breadcrumb-divider
Sass variable - kunye $breadcrumb-divider-flipped
ne-RTL iqabane layo, ukuba kuyimfuneko. Asigqibekanga kuguquguquko lwethu lwe-Sass, olusetwa njengokubuyela umva kwipropati yesiko. Ngale ndlela, ufumana isahluli sehlabathi onokuthi usikhuphe ngaphandle kokubuyisela i-CSS nangaliphi na ixesha.
<nav style="--bs-breadcrumb-divider: '>';" aria-label="breadcrumb">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="#">Home</a></li>
<li class="breadcrumb-item active" aria-current="page">Library</li>
</ol>
</nav>
Xa ulungisa nge-Sass, umsebenzi wocaphulo uyafuneka ukuvelisa ucaphulo malunga nomtya. Umzekelo, usebenzisa >
njengesahluli, ungasebenzisa oku:
$breadcrumb-divider: quote(">");
Kuyenzeka kwakhona ukusebenzisa i icon elungisiweyo yeSVG . Yisebenzise ngepropathi yethu yeCSS, okanye usebenzise iSass variable.
Ukusebenzisa i-SVG elungisiweyo
I-Inlining SVG njengedatha ye-URI ifuna ukuba i-URL ibaleke amagama ambalwa, ngakumbi <
, >
kunye #
. Yiyo loo nto $breadcrumb-divider
umahluko ugqithiswa ngomsebenzi wethu we- escape-svg()
Sass . Xa usebenzisa ipropathi yesiko le-CSS, kufuneka u-URL ubalekele i-SVG yakho ngokwakho. Funda iinkcazo zikaKevin Weber kwiCodePen ngolwazi oluthe kratya malunga nokubaleka ntoni.
<nav style="--bs-breadcrumb-divider: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='8'%3E%3Cpath d='M2.5 0L1 1.5 3.5 4 1 6.5 2.5 8l4-4-4-4z' fill='%236c757d'/%3E%3C/svg%3E");" aria-label="breadcrumb">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="#">Home</a></li>
<li class="breadcrumb-item active" aria-current="page">Library</li>
</ol>
</nav>
$breadcrumb-divider: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='8' height='8'><path d='M2.5 0L1 1.5 3.5 4 1 6.5 2.5 8l4-4-4-4z' fill='#{$breadcrumb-divider-color}'/></svg>");
Unako kwakhona ukususa isicwangciso sesahluli --bs-breadcrumb-divider: '';
(iintambo ezingenanto kwiipropati zesiko le-CSS zibala njengexabiso), okanye ukuseta i-Sass variables ukuya $breadcrumb-divider: none;
.
<nav style="--bs-breadcrumb-divider: '';" aria-label="breadcrumb">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="#">Home</a></li>
<li class="breadcrumb-item active" aria-current="page">Library</li>
</ol>
</nav>
$breadcrumb-divider: none;
Ukufikeleleka
Kuba i-breadcrumbs ibonelela ngokujonga, luluvo oluhle ukongeza ileyibhile enentsingiselo efana aria-label="breadcrumb"
nokuchaza uhlobo lokukhangela olunikezelweyo <nav>
kwinto, kunye nokusebenzisa into aria-current="page"
yokugqibela yeseti ukubonisa ukuba imele iphepha langoku.
Ngolwazi oluthe vetshe, jonga i- ARIA Authoring Practices Guide pattern pattern .
CSS
Izinto eziguquguqukayo
Ifakwe kwi-v5.2.0Njengenxalenye yendlela yokuguquguquka kwe-CSS ye-Bootstrap, i-breadcrumbs ngoku zisebenzisa iiguquguquko ze-CSS zasekhaya .breadcrumb
ukuze kuphuculwe ukwenziwa ngokwezifiso kwexesha lokwenyani. Amaxabiso okuguquguquka kweCSS asetwe ngeSass, ngoko ke ukwenziwa ngokwezifiso kweSass kusaxhaswa, nako.
--#{$prefix}breadcrumb-padding-x: #{$breadcrumb-padding-x};
--#{$prefix}breadcrumb-padding-y: #{$breadcrumb-padding-y};
--#{$prefix}breadcrumb-margin-bottom: #{$breadcrumb-margin-bottom};
@include rfs($breadcrumb-font-size, --#{$prefix}breadcrumb-font-size);
--#{$prefix}breadcrumb-bg: #{$breadcrumb-bg};
--#{$prefix}breadcrumb-border-radius: #{$breadcrumb-border-radius};
--#{$prefix}breadcrumb-divider-color: #{$breadcrumb-divider-color};
--#{$prefix}breadcrumb-item-padding-x: #{$breadcrumb-item-padding-x};
--#{$prefix}breadcrumb-item-active-color: #{$breadcrumb-active-color};
Iinguqu zeSass
$breadcrumb-font-size: null;
$breadcrumb-padding-y: 0;
$breadcrumb-padding-x: 0;
$breadcrumb-item-padding-x: .5rem;
$breadcrumb-margin-bottom: 1rem;
$breadcrumb-bg: null;
$breadcrumb-divider-color: $gray-600;
$breadcrumb-active-color: $gray-600;
$breadcrumb-divider: quote("/");
$breadcrumb-divider-flipped: $breadcrumb-divider;
$breadcrumb-border-radius: null;