Progress
Dokumentazzjoni u eżempji għall-użu tal-vireg tal-progress tad-dwana tal-Bootstrap li fihom appoġġ għal bars f'munzelli, sfondi animati, u tikketti tat-test.
Kif taħdem
Il-komponenti tal-progress huma mibnija b'żewġ elementi HTML, xi CSS biex tissettja l-wisa ', u ftit attributi. Aħna ma nużawx l- element HTML5<progress>
, u niżguraw li tista 'stack bars tal-progress, tanimahom, u tpoġġi tikketti tat-test fuqhom.
- Aħna nużaw il-
.progress
bħala tgeżwir biex jindikaw il-valur massimu tal-bar tal-progress. - Aħna nużaw l-interjuri
.progress-bar
biex nindikaw il-progress s'issa. - Il
.progress-bar
teħtieġ stil inline, klassi ta 'utilità, jew CSS tad-dwana biex tissettja l-wisa' tagħhom. - Il
.progress-bar
teħtieġ ukoll xirole
uaria
attributi biex jagħmluha aċċessibbli, inkluż isem aċċessibbli (bl-użuaria-label
,aria-labelledby
, jew simili).
Poġġi dan kollu flimkien, u għandek l-eżempji li ġejjin.
<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 jipprovdi numru żgħir ta ' utilitajiet għall-issettjar tal-wisa' . Skont il-bżonnijiet tiegħek, dawn jistgħu jgħinu fil-konfigurazzjoni tal-progress malajr.
<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>
Tikketti
Żid it-tikketti mal-vireg tal-progress tiegħek billi tpoġġi test fi ħdan il- .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>
Għoli
Aħna nissettjaw biss height
valur fuq il- .progress
, għalhekk jekk tibdel dak il-valur il-parti ta 'ġewwa .progress-bar
awtomatikament terġa' d-daqs xieraq.
<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>
Sfondi
Uża klassijiet ta 'utilità fl-isfond biex tbiddel id-dehra tal-vireg tal-progress individwali.
<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>
Twassal tifsira għal teknoloġiji ta' assistenza
L-użu tal-kulur biex iżżid it-tifsira jipprovdi biss indikazzjoni viżwali, li mhux se tiġi mgħoddija lill-utenti ta 'teknoloġiji ta' assistenza - bħal screen readers. Kun żgur li l-informazzjoni indikata bil-kulur hija jew ovvja mill-kontenut innifsu (eż. it-test viżibbli), jew tkun inkluża permezz ta' mezzi alternattivi, bħal test addizzjonali moħbi mal- .visually-hidden
klassi.
Bars multipli
Inkludi diversi bars tal-progress f'komponent tal-progress jekk għandek bżonn.
<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>
Strixxat
Żid .progress-bar-striped
ma' kwalunkwe .progress-bar
biex tapplika strixxa permezz ta' gradjent CSS fuq il-kulur tal-isfond tal-bar tal-progress.
<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>
Strixxi animati
Il-gradjent strixxat jista 'jkun animat ukoll. Żid .progress-bar-animated
ma .progress-bar
biex janima l-istrixxi dritt għal xellug permezz ta 'animazzjonijiet 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
Varjabbli
Miżjud fi v5.2.0Bħala parti mill-approċċ tal-varjabbli tas-CSS li qed jevolvu ta' Bootstrap, il-vireg tal-progress issa jużaw varjabbli tas-CSS lokali .progress
għal adattament imtejjeb f'ħin reali. Il-valuri għall-varjabbli CSS huma stabbiliti permezz ta 'Sass, għalhekk il-personalizzazzjoni ta' Sass għadha appoġġjata wkoll.
--#{$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 varjabbli
$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;
Keyframes
Użat għall-ħolqien ta' animazzjonijiet CSS għal .progress-bar-animated
. Inkluż fi scss/_progress-bar.scss
.
@if $enable-transitions {
@keyframes progress-bar-stripes {
0% { background-position-x: $progress-height; }
}
}