Holomua
ʻO ka palapala a me nā laʻana no ka hoʻohana ʻana i nā pahu holomua maʻamau Bootstrap e hōʻike ana i ke kākoʻo no nā pahu i hoʻopaʻa ʻia, nā ʻaoʻao animated, a me nā lepili kikokikona.
Pehea e hana ai
Kūkulu ʻia nā ʻāpana holomua me ʻelua mau mea HTML, kekahi CSS e hoʻonohonoho i ka laulā, a me kekahi mau ʻano. ʻAʻole mākou e hoʻohana i ka HTML5 <progress>
element , e hōʻoia ana hiki iā ʻoe ke hoʻopaʻa i nā pae holomua, hoʻoulu iā lākou, a kau i nā lepili kikokikona ma luna o lākou.
- Hoʻohana mākou i ka
.progress
mea e ʻōwili ai e hōʻike i ka waiwai nui o ka pae holomua. - Hoʻohana mākou i ka loko
.progress-bar
e hōʻike i ka holomua i kēia manawa. - Pono
.progress-bar
ke ʻano inline, papa pono, a i ʻole CSS maʻamau e hoʻonohonoho i ko lākou laulā. - Pono
.progress-bar
pū kekahi i kekahirole
a mearia
nā ʻano e hiki ai ke ʻike ʻia, me kahi inoa hiki ke ʻike ʻia (hoʻohana ʻiaaria-label
,aria-labelledby
, a i ʻole like).
E hoʻohui i nā mea a pau, a loaʻa iā ʻoe kēia mau hiʻohiʻona.
<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>
Hāʻawi ʻo Bootstrap i kahi lima o nā pono hana no ka hoʻonohonoho ʻana i ka laulā . Ma muli o kāu mau pono, kōkua paha kēia i ka hoʻonohonoho wikiwiki ʻana i ka holomua.
<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>
Lepili
Hoʻohui i nā lepili i kāu mau pae holomua ma ke kau ʻana i nā kikokikona i loko o ka .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>
Kiʻekiʻe
Hoʻonoho wale mākou i kahi height
waiwai ma ka .progress
, no laila inā hoʻololi ʻoe i kēlā waiwai .progress-bar
e hoʻololi ʻokoʻa ka mea i loko.
<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>
Nā kāʻei kua
E hoʻohana i nā papa hana hope e hoʻololi i ke ʻano o nā pae holomua.
<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>
Ka lawe ʻana i ka manaʻo i nā ʻenehana kōkua
ʻO ka hoʻohana ʻana i ke kala e hoʻohui i ka manaʻo e hāʻawi wale i kahi hōʻailona ʻike, ʻaʻole e hāʻawi ʻia i nā mea hoʻohana i nā ʻenehana kōkua - e like me nā mea heluhelu pale. E hōʻoia i ka ʻike i hōʻike ʻia e ka waihoʻoluʻu i ʻike ʻia mai ka maʻiʻo ponoʻī (e laʻa i ke kikokikona ʻike ʻia), a i ʻole e hoʻokomo ʻia ma o nā ala ʻē aʻe, e like me nā kikokikona hou i hūnā ʻia me ka .visually-hidden
papa.
Nā pā he nui
E hoʻokomo i nā pahu holomua he nui i kahi ʻāpana holomua inā pono ʻoe.
<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>
ʻōniʻoniʻo
Hoʻohui .progress-bar-striped
i kekahi .progress-bar
e hoʻopili i kahi kāʻei ma o CSS gradient ma luna o ke kala hope o ka pae holomua.
<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>
Nā kaha ʻoniʻoni
Hiki ke hoʻolalelale ʻia ke kaha kaha kaha. Hoʻohui .progress-bar-animated
i .progress-bar
e hoʻolalelale i nā kaha ʻākau a hema ma o CSS3 animations.
<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
Nā mea hoʻololi
Hoʻohui ʻia ma v5.2.0Ma ke ʻano o ka hoʻololi ʻana o nā ʻano hoʻololi CSS o Bootstrap, hoʻohana nā pae holomua i nā ʻano CSS kūloko .progress
no ka hoʻomaikaʻi ʻana i ka manawa maoli. Hoʻonohonoho ʻia nā waiwai no nā ʻano CSS ma o Sass, no laila ke kākoʻo mau ʻia nei ka hana maʻamau Sass.
--#{$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};
Nā hoʻololi 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;
Nā pahu kī
Hoʻohana ʻia no ka hana ʻana i nā animation CSS no .progress-bar-animated
. Hoʻokomo ʻia i loko o scss/_progress-bar.scss
.
@if $enable-transitions {
@keyframes progress-bar-stripes {
0% { background-position-x: $progress-height; }
}
}