Ọganihu
Akwụkwọ na ihe atụ maka iji ogwe ọganihu omenala Bootstrap nke na-egosipụta nkwado maka ogwe ndị ekpokọtara, nzụlite eserese, na akara ederede.
Ka o si arụ ọrụ
A na-eji ihe HTML abụọ wuo ihe na-aga n'ihu, ụfọdụ CSS iji tọọ obosara, yana àgwà ole na ole. We don't use the HTML5 <progress>
element , n'ịhụ na ị nwere ike tojupụtara ọganihu mmanya, animate ha, na-etinye ederede akara n'elu ha.
- Anyị na-eji ya
.progress
dị ka ihe mkpuchi iji gosi uru bara uru nke ogwe ọganihu. - Anyị na-eji n'ime
.progress-bar
gosi ọganihu dị ugbu a. - Nke
.progress-bar
a chọrọ ụdị inline, klaasị ịba uru, ma ọ bụ omenala CSS iji tọọ obosara ha. - Nke
.progress-bar
ahụ chọkwara ụfọdụrole
naaria
njirimara iji mee ka ọ nweta ya, gụnyere aha enwere ike ịnweta (ijiaria-label
,aria-labelledby
, ma ọ bụ yiri ya).
Tinye ihe niile ọnụ, ma ị nwere ihe atụ ndị a.
<div class="progress">
<div class="progress-bar" role="progressbar" aria-label="Basic example" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100"></div>
</div>
<div class="progress">
<div class="progress-bar" role="progressbar" aria-label="Basic example" style="width: 25%" aria-valuenow="25" aria-valuemin="0" aria-valuemax="100"></div>
</div>
<div class="progress">
<div class="progress-bar" role="progressbar" aria-label="Basic example" style="width: 50%" aria-valuenow="50" aria-valuemin="0" aria-valuemax="100"></div>
</div>
<div class="progress">
<div class="progress-bar" role="progressbar" aria-label="Basic example" style="width: 75%" aria-valuenow="75" aria-valuemin="0" aria-valuemax="100"></div>
</div>
<div class="progress">
<div class="progress-bar" role="progressbar" aria-label="Basic example" style="width: 100%" aria-valuenow="100" aria-valuemin="0" aria-valuemax="100"></div>
</div>
Bootstrap na-enye ngwa ọrụ ole na ole maka ịtọ obosara . Dabere na mkpa gị, ndị a nwere ike inye aka na ịhazi ọganihu ngwa ngwa.
<div class="progress">
<div class="progress-bar w-75" role="progressbar" aria-label="Basic example" aria-valuenow="75" aria-valuemin="0" aria-valuemax="100"></div>
</div>
Akara aha
Tinye akara na ogwe ọganihu gị site na itinye ederede n'ime faịlụ .progress-bar
.
<div class="progress">
<div class="progress-bar" role="progressbar" aria-label="Example with label" style="width: 25%;" aria-valuenow="25" aria-valuemin="0" aria-valuemax="100">25%</div>
</div>
Ogologo
Naanị ihe anyị na-edobere height
uru na .progress
, yabụ ọ bụrụ na ị gbanwee uru ahụ, nke dị n'ime .progress-bar
ga-emegharị ya ozugbo.
<div class="progress" style="height: 1px;">
<div class="progress-bar" role="progressbar" aria-label="Example 1px high" style="width: 25%;" aria-valuenow="25" aria-valuemin="0" aria-valuemax="100"></div>
</div>
<div class="progress" style="height: 20px;">
<div class="progress-bar" role="progressbar" aria-label="Example 20px high" style="width: 25%;" aria-valuenow="25" aria-valuemin="0" aria-valuemax="100"></div>
</div>
Ndabere
Jiri klaasị ịba uru n'okirikiri iji gbanwee ọdịdị nke ogwe ọganihu n'otu n'otu.
<div class="progress">
<div class="progress-bar bg-success" role="progressbar" aria-label="Success example" style="width: 25%" aria-valuenow="25" aria-valuemin="0" aria-valuemax="100"></div>
</div>
<div class="progress">
<div class="progress-bar bg-info" role="progressbar" aria-label="Info example" style="width: 50%" aria-valuenow="50" aria-valuemin="0" aria-valuemax="100"></div>
</div>
<div class="progress">
<div class="progress-bar bg-warning" role="progressbar" aria-label="Warning example" style="width: 75%" aria-valuenow="75" aria-valuemin="0" aria-valuemax="100"></div>
</div>
<div class="progress">
<div class="progress-bar bg-danger" role="progressbar" aria-label="Danger example" style="width: 100%" aria-valuenow="100" aria-valuemin="0" aria-valuemax="100"></div>
</div>
Na-eme ka ọ pụta ìhè na teknụzụ enyemaka
Iji agba iji gbakwunye ihe ọ pụtara naanị na-enye ihe ngosi anya, nke a na-agaghị ebugara ndị ọrụ teknụzụ enyemaka - dị ka ndị na-agụ ihuenyo. Gbaa mbọ hụ na ozi nke agba gosipụtara pụtara ìhè site na ọdịnaya n'onwe ya (dịka ederede a na-ahụ anya), ma ọ bụ tinye ya site na ụzọ ọzọ, dị ka ederede agbakwunyere zoro ezo na .visually-hidden
klaasị.
Otutu mmanya
Tinye ọtụtụ ogwe ọganihu n'ime akụrụngwa ọganihu ma ọ bụrụ na ịchọrọ.
<div class="progress">
<div class="progress-bar" role="progressbar" aria-label="Segment one" style="width: 15%" aria-valuenow="15" aria-valuemin="0" aria-valuemax="100"></div>
<div class="progress-bar bg-success" role="progressbar" aria-label="Segment two" style="width: 30%" aria-valuenow="30" aria-valuemin="0" aria-valuemax="100"></div>
<div class="progress-bar bg-info" role="progressbar" aria-label="Segment three" style="width: 20%" aria-valuenow="20" aria-valuemin="0" aria-valuemax="100"></div>
</div>
Ekewapụ
Tinye .progress-bar-striped
na nke ọ bụla .progress-bar
iji tinye eriri site na CSS gradient n'elu agba ndabere mmanya ọganihu.
<div class="progress">
<div class="progress-bar progress-bar-striped" role="progressbar" aria-label="Default striped example" style="width: 10%" aria-valuenow="10" aria-valuemin="0" aria-valuemax="100"></div>
</div>
<div class="progress">
<div class="progress-bar progress-bar-striped bg-success" role="progressbar" aria-label="Success striped example" style="width: 25%" aria-valuenow="25" aria-valuemin="0" aria-valuemax="100"></div>
</div>
<div class="progress">
<div class="progress-bar progress-bar-striped bg-info" role="progressbar" aria-label="Info striped example" style="width: 50%" aria-valuenow="50" aria-valuemin="0" aria-valuemax="100"></div>
</div>
<div class="progress">
<div class="progress-bar progress-bar-striped bg-warning" role="progressbar" aria-label="Warning striped example" style="width: 75%" aria-valuenow="75" aria-valuemin="0" aria-valuemax="100"></div>
</div>
<div class="progress">
<div class="progress-bar progress-bar-striped bg-danger" role="progressbar" aria-label="Danger striped example" style="width: 100%" aria-valuenow="100" aria-valuemin="0" aria-valuemax="100"></div>
</div>
Uriri na-emegharị anya
Enwere ike ịmegharị gradient nke eriri. Tinye .progress-bar-animated
n'ime .progress-bar
ka emee ọnyá ndị dị n'aka nri gaa n'aka ekpe site na animation CSS3.
<div class="progress">
<div class="progress-bar progress-bar-striped progress-bar-animated" role="progressbar" aria-label="Animated striped example" aria-valuenow="75" aria-valuemin="0" aria-valuemax="100" style="width: 75%"></div>
</div>
CSS
Mgbanwe
Agbakwunyere na v5.2.0Dị ka akụkụ nke mgbanwe mgbanwe CSS nke Bootstrap, ogwe ọganihu na-ejizi mgbanwe CSS mpaghara .progress
maka imeziwanye ezigbo oge. A na-edozi ụkpụrụ maka mgbanwe CSS site na Sass, yabụ ka na-akwado nhazi Sass, kwa.
--#{$prefix}progress-height: #{$progress-height};
@include rfs($progress-font-size, --#{$prefix}progress-font-size);
--#{$prefix}progress-bg: #{$progress-bg};
--#{$prefix}progress-border-radius: #{$progress-border-radius};
--#{$prefix}progress-box-shadow: #{$progress-box-shadow};
--#{$prefix}progress-bar-color: #{$progress-bar-color};
--#{$prefix}progress-bar-bg: #{$progress-bar-bg};
--#{$prefix}progress-bar-transition: #{$progress-bar-transition};
Sass variables
$progress-height: 1rem;
$progress-font-size: $font-size-base * .75;
$progress-bg: $gray-200;
$progress-border-radius: $border-radius;
$progress-box-shadow: $box-shadow-inset;
$progress-bar-color: $white;
$progress-bar-bg: $primary;
$progress-bar-animation-timing: 1s linear infinite;
$progress-bar-transition: width .6s ease;
Igwe igodo
Eji maka imepụta animation CSS maka .progress-bar-animated
. Agụnyere na scss/_progress-bar.scss
.
@if $enable-transitions {
@keyframes progress-bar-stripes {
0% { background-position-x: $progress-height; }
}
}