Imvuthuluka yesinkwa
Bonisa indawo yekhasi lamanje phakathi kwesigaba sokuhamba esingeza izihlukanisi ngokuzenzakalelayo nge-CSS.
Isibonelo
Sebenzisa uhlu olu-odwe noma olunga-odwe olunezinto zohlu oluxhumene ukuze udale imvuthuluka yesinkwa enesitayela esincane. Sebenzisa izinsiza zethu ukwengeza izitayela ezengeziwe njengoba uthanda.
<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>
Abahlukanisi
Izihlukanisi zengezwa ngokuzenzakalelayo ku-CSS nge- ::before
. content
Angashintshwa ngokushintsha indawo yangokwezifiso ye-CSS --bs-breadcrumb-divider
, noma ngokuhlukahluka kwe- $breadcrumb-divider
Sass — kanye $breadcrumb-divider-flipped
nozakwabo we-RTL, uma kudingeka. Sizenzakalela kokuguquguquka kwethu kwe-Sass, okusethwe njengokubuyela emuva endaweni yangokwezifiso. Ngale ndlela, uthola isihlukanisi somhlaba wonke ongakwazi ukusibhala ngaphandle kokubuyisela i-CSS noma kunini.
<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>
Uma ulungisa nge-Sass, umsebenzi wokucaphuna uyadingeka ukuze ukhiqize izingcaphuno eduze kweyunithi yezinhlamvu. Isibonelo, usebenzisa >
njengesihlukanisi, ungasebenzisa lokhu:
$breadcrumb-divider: quote(">");
Kuyenzeka futhi usebenzise isithonjana esishumekiwe se-SVG . Sisebenzise ngempahla yethu yangokwezifiso ye-CSS, noma sebenzisa okuguquguqukayo kwe-Sass.
Isebenzisa i-SVG eshumekiwe
Ukufaka i-SVG ku-inlining njenge-URI yedatha kudinga ukuze i-URL ibalekele izinhlamvu ezimbalwa, ikakhulukazi <
, >
kanye #
. Kungakho $breadcrumb-divider
okuguquguqukayo kudluliselwa ngomsebenzi wethu escape-svg()
we-Sass . Uma usebenzisa isici sangokwezifiso se-CSS, udinga uku-URL ubalekele i-SVG yakho ngokwakho. Funda izincazelo zikaKevin Weber ku-CodePen ukuze uthole imininingwane enemininingwane yokuthi yini ongayibalekela.
<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>");
Ungakwazi futhi ukususa ukulungiselelwa kwesihlukanisi --bs-breadcrumb-divider: '';
(amayunithi ezinhlamvu angenalutho ezicini zangokwezifiso ze-CSS abalwa njengevelu), noma ukusetha okuguquguqukayo kwe-Sass ku- $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;
Ukufinyeleleka
Njengoba i-breadcrumbs ihlinzeka ngokuzulazula, kuwumqondo omuhle ukwengeza ilebula enengqondo njengokuchaza aria-label="breadcrumb"
uhlobo lokuzulazula olunikezwe <nav>
kusici, kanye nokusebenzisa aria-current="page"
okuthi entweni yokugcina yesethi ukukhombisa ukuthi imele ikhasi lamanje.
Ukuze uthole ulwazi olwengeziwe, bona I- ARIA Authoring Practices Guide iphethini ye-breadcrumb .
CSS
Okuguquguqukayo
Kwengezwe ku-v5.2.0Njengengxenye yendlela yokuguquguquka kwe-CSS ye-Bootstrap, ama-breadcrumbs manje asebenzisa okuguquguqukayo kwasendaweni kwe-CSS .breadcrumb
ukuze kwenziwe ngokwezifiso isikhathi sangempela. Amanani okuguquguquka kwe-CSS asethwa nge-Sass, ngakho ukwenza ngokwezifiso kwe-Sass kusasekelwa, nakho.
--#{$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};
Izinguquko ze-Sass
$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;