Nri achịcha
Gosipụta ọnọdụ ibe dị ugbu a n'ime usoro ịnyagharị na-agbakwunye ndị nkewa na-akpaghị aka site na CSS.
Ọmụmaatụ
Jiri ndepụta enyere iwu ma ọ bụ enweghị usoro nwere ihe ndetu ejikọtara iji mepụta obere achịcha edoziri obere. Jiri ngwa anyị ịgbakwunye ụdị ndị ọzọ dịka achọrọ.
<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>
Ndị nkesa
A na-agbakwunye ndị nkesa na-akpaghị aka na CSS site ::before
na na content
. Enwere ike ịgbanwe ha site na ịmegharị ihe onwunwe omenala CSS mpaghara --bs-breadcrumb-divider
, ma ọ bụ site na $breadcrumb-divider
mgbanwe Sass - yana $breadcrumb-divider-flipped
maka ndị otu RTL ya, ọ bụrụ na ọ dị mkpa. Anyị na-adaba na mgbanwe Sass anyị, nke edobere dị ka ndaghachi azụ na akụrụngwa omenala. N'ụzọ dị otú a, ị ga-enweta nkesa zuru ụwa ọnụ nke ị nwere ike ịkagbu na-enweghị achịkọta CSS n'oge ọ bụla.
<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>
Mgbe ị na-agbanwe site na Sass, a na -achọ ọrụ ntinye akwụkwọ iji mepụta nhota ndị dị n'akụkụ eriri. Dịka ọmụmaatụ, iji >
dị ka nkesa, ịnwere ike iji nke a:
$breadcrumb-divider: quote(">");
Ọ dịkwa ike iji akara ngosi SVG agbakwunyere . Tinye ya site na akụrụngwa omenala CSS anyị, ma ọ bụ jiri mgbanwe Sass.
Iji SVG agbakwunyere
Inlining SVG dị ka data URI chọrọ ka URL gbanarị mkpụrụedemede ole na ole, ọkachasị <
, >
na #
. Ọ bụ ya mere $breadcrumb-divider
mgbanwe ahụ ji agafe escape-svg()
ọrụ Sass anyị . Mgbe ị na-eji akụrụngwa omenala CSS, ị ga-achọ URL gbanarị SVG gị n'onwe gị. Gụọ nkọwa Kevin Weber na CodePen maka ozi zuru ezu gbasara ihe ị ga-agbanarị.
<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>");
Ị nwekwara ike wepụ ntọala nkesa --bs-breadcrumb-divider: '';
(ụdọ efu na CSS omenala Properties na-agụ dị ka uru), ma ọ bụ ịtọ Sass variable ka $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;
Nnweta
Ebe ọ bụ na achịcha achịcha na-enye igodo, ọ dị mma ịgbakwunye akara nwere uru dị ka aria-label="breadcrumb"
ịkọwapụta ụdị igodo enyere na <nav>
mmewere, yana itinye ihe aria-current="page"
na ihe ikpeazụ nke setịpụrụ iji gosi na ọ na-anọchi anya ibe dị ugbu a.
Maka ozi ndị ọzọ, lee ARIA Ntuziaka Omume Ntuziaka breadcrumb .
CSS
Mgbanwe
Agbakwunyere na v5.2.0Dị ka akụkụ nke mgbanwe mgbanwe CSS nke Bootstrap, achịcha na-ejizi mgbanwe CSS mpaghara .breadcrumb
maka imeziwanye ezigbo oge. A na-edozi ụkpụrụ maka mgbanwe CSS site na Sass, yabụ ka na-akwado nhazi Sass, kwa.
--#{$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 variables
$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;