Abodoo a wɔayam
Kyerɛ beae a krataafa a ɛwɔ hɔ mprempren no wɔ wɔ akwantu nhyehyɛe bi a ɛde mpaapaemu ahorow ka ho ankasa denam CSS so.
Nhwɛsoɔ
Fa list a wɔahyehyɛ anaa wɔanhyehyɛ a wɔahyehyɛ nneɛma a ɛwɔ link mu di dwuma fa yɛ breadcrumb a wɔayɛ no kakraa bi. Fa yɛn utilities no fa styles foforo ka ho sɛnea wopɛ.
<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>
Nneɛma a wɔkyekyɛ mu
Wɔde dividers ka ho wɔ CSS mu ankasa denam ::before
ne content
. Wobetumi asesa wɔn denam nsakrae a wɔbɛyɛ wɔ CSS amanne agyapade a ɛwɔ mpɔtam hɔ no so --bs-breadcrumb-divider
, anaasɛ ɛnam $breadcrumb-divider
Sass nsakrae no so — ne $breadcrumb-divider-flipped
ne RTL yɔnko no, sɛ ɛho hia a. Yɛdefault kɔ yɛn Sass variable no so, a wɔde ato hɔ sɛ fallback kɔ custom property no so. Saa kwan yi so no, wobɛnya wiase nyinaa mpaapaemu a wobɛtumi abɔ so a worenboaboa CSS ano bio bere biara.
<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>
Sɛ woresakra denam Sass so a, ɛho hia sɛ quote adwuma no yɛ quotes a atwa ahama bi ho ahyia no. Sɛ nhwɛso no, sɛ wode di dwuma >
sɛ kyekyɛfo a, wubetumi de eyi adi dwuma:
$breadcrumb-divider: quote(">");
Ɛsan nso yɛ yie sɛ wode SVG ahyɛnsodeɛ a wɔde ahyɛ mu bedi dwuma . Fa di dwuma denam yɛn CSS custom property so, anaa fa Sass variable no di dwuma.
Sɛ wode SVG a wɔde ahyɛ mu di dwuma
Inlining SVG sɛ data URI hwehwɛ sɛ URL guan nkyerɛwde kakraa bi, titiriw <
, >
ne #
. Ɛno nti na $breadcrumb-divider
variable no fa yɛn escape-svg()
Sass function no mu no . Sɛ wode CSS amanneɛbɔ agyapade no redi dwuma a, ɛsɛ sɛ wo URL guan wo SVG no wɔ w’ankasa wo ho. Kenkan Kevin Weber nkyerɛkyerɛmu wɔ CodePen so ma nsɛm a ɛkɔ akyiri fa nea ɛsɛ sɛ wuguan ho.
<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>");
Wubetumi nso ayi mpaapaemu nhyehyɛe no afi hɔ --bs-breadcrumb-divider: '';
(nhama a hwee nni mu wɔ CSS amanne agyapade mu no bu akontaa sɛ botae), anaasɛ wode Sass nsakrae no besi $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;
Nneɛma a wotumi nya
Esiane sɛ breadcrumbs ma navigation nti, ɛyɛ adwene pa sɛ wode label a ntease wom bɛka ho te sɛ aria-label="breadcrumb"
nea wobɛkyerɛkyerɛ navigation ko a wɔde ama wɔ <nav>
element no mu, ne sɛnea wode an bedi dwuma aria-current="page"
wɔ ade a etwa to wɔ set no mu de akyerɛ sɛ egyina hɔ ma krataafa a ɛwɔ hɔ mprempren no.
Sɛ wopɛ nsɛm pii a, hwɛ ARIA Authoring Practices Guide breadcrumb pattern .
CSS a ɛwɔ hɔ no
Nneɛma a Ɛsakra
Wɔde aka ho wɔ v5.2.0 muSɛ́ Bootstrap CSS nsakrae kwan a ɛrekɔ so no fã no, mprempren breadcrumbs de mpɔtam hɔ CSS nsakrae ahorow di dwuma wɔ so .breadcrumb
ma bere ankasa mu nsakrae a ɛkɔ anim. Wɔde Sass so ahyɛ CSS nsakraeɛ no botaeɛ, enti Sass nhyehyɛɛ no da so ara boa, nso.
--#{$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};
Sass nsakrae ahorow
$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;