Te kongakonga taro
Tohua te waahi o te wharangi o naianei i roto i te arowhai whakaterenga ka taapiri aunoa i nga wehewehe ma te CSS.
Tauira
Whakamahia he rarangi raupapa, he rarangi kore ranei me nga tuemi rarangi hono hei hanga i tetahi kongakonga parāoa iti. Whakamahia a maatau taputapu ki te taapiri i nga momo taapiri e hiahiatia ana.
<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>
Kaiwehewehe
Ka taapiri aunoatia nga kaiwehewehe ki te CSS ::before
me te content
. Ka taea te whakarereke ma te whakarereke i tetahi taonga ritenga CSS rohe --bs-breadcrumb-divider
, ma te $breadcrumb-divider
taurangi Sass ranei - $breadcrumb-divider-flipped
mo tana hoa RTL, ki te hiahiatia. Ka taunoa matou ki ta maatau taurangi Sass, kua tautuhia hei takahuri ki te taonga ritenga. Ma tenei ara, ka whiwhi koe i te wehewehe o te ao ka taea e koe te whakakore me te kore e whakahiato CSS i nga wa katoa.
<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>
I te whakarereketanga ma te Sass, ka hiahiatia te mahi kii hei whakaputa i nga korukī huri noa i te aho. Hei tauira, ma >
te whakamahi hei kaiwehewehe, ka taea e koe te whakamahi i tenei:
$breadcrumb-divider: quote(">");
Ka taea hoki te whakamahi i te ata SVG kua whakauruhia . Hoatuhia ma o maatau taonga ritenga CSS, whakamahi ranei i te taurangi Sass.
Te whakamahi i te SVG kua whakauruhia
Ko te whakauru i te SVG hei raraunga URI e hiahia ana kia mawhiti te URL i etahi tohu, te nuinga <
, >
me te #
. Koia te take ka tukuna te $breadcrumb-divider
taurangi ki roto i ta maatau escape-svg()
mahi Sass . I te wa e whakamahi ana koe i te taonga ritenga CSS, me mawhiti atu koe i to SVG i to URL. Panuitia nga whakamarama a Kevin Weber mo CodePen mo nga korero taipitopito mo nga mea ka mawhiti.
<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>");
Ka taea hoki te tango i te tautuhinga wehewehe --bs-breadcrumb-divider: '';
(ko nga aho kau i roto i nga taonga ritenga CSS ka kiia he uara), ka tautuhi ranei i te taurangi Sass ki $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;
Te urunga
I te mea ko nga kongakonga parāoa he whakaterenga, he pai ki te taapiri i tetahi tapanga whai kiko penei i aria-label="breadcrumb"
te whakaahua i te momo whakaterenga e whakaratohia ana i roto i te <nav>
huānga, me te tono tohu aria-current="page"
ki te mea whakamutunga o te huinga hei tohu mo te wharangi o naianei.
Mo te roanga atu o nga korero, tirohia te tauira ARIA Authoring Practices Guide .
CSS
Taurangi
Kua taapirihia ki te v5.2.0Hei waahanga o nga huringa CSS e tipu haere ana a Bootstrap, ka whakamahia e nga kongakonga taro inaianei nga taurangi CSS rohe .breadcrumb
mo te whakapai ake i nga whakaritenga-wa-tuuturu. Ko nga uara mo nga taurangi CSS ka whakatauhia ma te Sass, no reira kei te tautoko tonu te whakaritenga Sass.
--#{$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};
Taurangi 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;