Rekọja si akoonu akọkọ Rekọja si lilọ kiri awọn docs
Check
in English

Ilọsiwaju

Iwe ati awọn apẹẹrẹ fun lilo awọn ọpa ilọsiwaju aṣa Bootstrap ti n ṣe afihan atilẹyin fun awọn ifi tolera, awọn ipilẹ ere idaraya, ati awọn aami ọrọ.

Bawo ni o ṣe n ṣiṣẹ

Awọn paati ilọsiwaju jẹ itumọ pẹlu awọn eroja HTML meji, diẹ ninu CSS lati ṣeto iwọn, ati awọn abuda diẹ. A ko lo eroja HTML5<progress> , ni idaniloju pe o le to awọn ọpa ilọsiwaju pọ, ṣe ere wọn, ati gbe awọn aami ọrọ si wọn.

  • A lo .progressbi ipari lati ṣe afihan iye ti o pọju ti ọpa ilọsiwaju.
  • A lo inu .progress-barlati fihan ilọsiwaju ti o jina.
  • Awọn .progress-barnilo ara opopo, kilasi ohun elo, tabi CSS aṣa lati ṣeto iwọn wọn.
  • Ohun naa .progress-bartun nilo diẹ ninu roleati awọn ariaabuda lati jẹ ki o wa, pẹlu orukọ wiwọle (lilo aria-label, aria-labelledby, tabi iru).

Fi gbogbo rẹ papọ, ati pe o ni awọn apẹẹrẹ wọnyi.

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>

Bootstrap pese iwonba awọn ohun elo fun eto iwọn . Ti o da lori awọn iwulo rẹ, iwọnyi le ṣe iranlọwọ pẹlu atunto ilọsiwaju ni iyara.

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>

Awọn akole

Ṣafikun awọn aami si awọn ifi ilọsiwaju rẹ nipa gbigbe ọrọ si inu faili .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>

Giga

A ṣeto heightiye nikan lori .progress, nitorina ti o ba yi iye yẹn pada, inu .progress-baryoo ṣe atunṣe laifọwọyi ni ibamu.

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>

Awọn ipilẹṣẹ

Lo awọn kilasi IwUlO abẹlẹ lati yi irisi awọn ifi ilọsiwaju kọọkan pada.

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>
Gbigbe itumo si awọn imọ-ẹrọ iranlọwọ

Lilo awọ lati ṣafikun itumọ nikan n pese itọkasi wiwo, eyiti kii yoo gbe lọ si awọn olumulo ti awọn imọ-ẹrọ iranlọwọ - gẹgẹbi awọn oluka iboju. Rii daju pe alaye ti o tọka si nipasẹ awọ jẹ eyiti o han gbangba lati inu akoonu funrararẹ (fun apẹẹrẹ ọrọ ti o han), tabi pẹlu pẹlu awọn ọna omiiran, gẹgẹbi afikun ọrọ ti o farapamọ pẹlu .visually-hiddenkilasi naa.

Awọn ifipa pupọ

Fi awọn ifi ilọsiwaju lọpọlọpọ sinu paati ilọsiwaju ti o ba nilo.

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>

Ṣiṣiri

Ṣafikun .progress-bar-stripedsi eyikeyi .progress-barlati lo adikala kan nipasẹ gradient CSS lori awọ abẹlẹ ọpa ilọsiwaju.

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>

Ti ere idaraya orisirisi

Didient ṣi kuro tun le ṣe ere idaraya. Fikun -un .progress-bar-animatedlati .progress-barmu awọn ila si ọtun si osi nipasẹ awọn ohun idanilaraya 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

Awọn oniyipada

Fi kun v5.2.0

Gẹ́gẹ́ bí ara Bootstrap’s títúnṣe àwọn oníyípadà CSS, àwọn ọpá ìlọsíwájú nísinsìnyí ń lo àwọn oniyipada CSS ti agbegbe .progressfun imudara isọdi-akoko gidi. Awọn iye fun awọn oniyipada CSS ti ṣeto nipasẹ Sass, nitorinaa isọdi Sass tun ni atilẹyin, paapaa.

  --#{$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 oniyipada

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

Awọn fireemu bọtini

Ti a lo fun ṣiṣẹda awọn ohun idanilaraya CSS fun .progress-bar-animated. To wa ninu scss/_progress-bar.scss.

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