Yeqela kokuqukethwe okuyinhloko Yeqela ku-docs navigation
Check
in English

Inqubekelaphambili

Amadokhumenti nezibonelo zokusebenzisa amabha enqubekela-phambili e-Bootstrap afaka usekelo lwamabha astakiwe, ingemuva eligqwayizayo, namalebula ombhalo.

Isebenza kanjani

Izingxenye zokuqhubeka zakhiwe ngezici ezimbili ze-HTML, enye i-CSS yokusetha ububanzi, kanye nezibaluli ezimbalwa. Asisebenzisi isici se -HTML5<progress> , siqinisekisa ukuthi ungakwazi ukunqwabelanisa amabha enqubekelaphambili, uwaphilise, futhi ubeke amalebula ombhalo phezu kwawo.

  • Sisebenzisa .progressnjengesonga ukukhombisa inani eliphezulu lebha yokuqhubeka.
  • Sisebenzisa ingaphakathi .progress-barukukhombisa inqubekelaphambili kuze kube manje.
  • .progress-barIdinga isitayela esisemgqeni, isigaba sokusetshenziswa, noma i-CSS yangokwezifiso ukuze usethe ububanzi bazo .
  • I-The .progress-barfuthi idinga okunye rolekanye arianezibaluli ukuze iyenze ifinyeleleke, kuhlanganise negama elifinyelelekayo (usebenzisa aria-label, aria-labelledby, noma okufanayo).

Kuhlanganise konke lokho, futhi unezibonelo ezilandelayo.

html
<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>

I-Bootstrap inikeza izinsiza ezimbalwa zokusetha ububanzi . Ngokuya ngezidingo zakho, lezi zingasiza ekulungiseleleni ngokushesha ukuqhubeka.

html
<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>

Amalebula

Engeza amalebula kubha yakho yokuqhubeka ngokubeka umbhalo ngaphakathi kwe- .progress-bar.

25%
html
<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>

Ubude

Sisetha kuphela heightinani ku- .progress, ngakho-ke uma ushintsha lelo nani elingaphakathi lizoshintsha .progress-barusayizi ngokuzenzakalelayo ngokufanele.

html
<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>

Ingemuva

Sebenzisa amakilasi ensiza engemuva ukuze uguqule ukubukeka kwebha yokuqhubeka ngayinye.

html
<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>
Ukudlulisa incazelo kubuchwepheshe obusizayo

Ukusebenzisa umbala ukwengeza incazelo kunikeza kuphela inkomba ebonakalayo, engeke idluliselwe kubasebenzisi bobuchwepheshe obusizayo - njengezifundi zesikrini. Qinisekisa ukuthi ulwazi olushiwo umbala lusobala kokuqukethwe ngokwako (isb umbhalo obonakalayo), noma lufakwe ngezinye izindlela, njengombhalo owengeziwe ofihliwe .visually-hiddennekilasi.

Amabha amaningi

Faka phakathi imigoqo yenqubekela-phambili eminingi engxenyeni yenqubekelaphambili uma uyidinga.

html
<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>

Inemithende

Engeza .progress-bar-stripedkunoma yikuphi .progress-barukuze usebenzise umugqa nge-CSS gradient phezu kombala wangemuva webha yokuqhubeka.

html
<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>

Imigqa egqwayizayo

I-gradient enemigqa nayo ingagqwayiza. Engeza .progress-bar-animatedukuze .progress-barugqwayize imithende kwesokudla kuye kwesokunxele ngokusebenzisa opopayi be-CSS3.

html
<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

Okuguquguqukayo

Kwengezwe ku-v5.2.0

Njengengxenye yendlela yokuguquguquka ye-CSS ye-Bootstrap, imigoqo yokuqhubeka manje isebenzisa okuguquguqukayo kwendawo .progressye-CSS ukuze kwenziwe ngokwezifiso isikhathi sangempela esithuthukisiwe. Amanani okuguquguquka kwe-CSS asethwa nge-Sass, ngakho ukwenza ngokwezifiso kwe-Sass kusasekelwa, nakho.

  --#{$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};
  

Izinguquko ze-Sass

$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;

Ozimele abangukhiye

Isetshenziselwa ukudala izithombe ze-CSS ze- .progress-bar-animated. Kufakwe ku scss/_progress-bar.scss.

@if $enable-transitions {
  @keyframes progress-bar-stripes {
    0% { background-position-x: $progress-height; }
  }
}