Te ahunga whakamua
Ko nga tuhinga me nga tauira mo te whakamahi i nga pae whakamua ritenga a Bootstrap e whakaatu ana i te tautoko mo nga tutaki kua tapae, nga papamuri pakiwaituhi, me nga tapanga kupu.
Pehea te mahi
Ko nga waahanga o te ahunga whakamua ka hangaia me nga huānga HTML e rua, etahi CSS hei tautuhi i te whanui, me etahi huanga. Kare matou e whakamahi i te huānga HTML5<progress>
, me te whakarite ka taea e koe te tarai i nga pae ahunga whakamua, te whakakorikori, me te whakanoho i nga tapanga kuputuhi ki runga.
- Ka whakamahia e matou te
.progress
hei takai hei tohu i te uara teitei o te pae ahunga whakamua. - Ka whakamahia e matou te roto
.progress-bar
hei tohu i te ahunga whakamua i tenei wa. - Ko te
.progress-bar
hiahia he ahua raina, he karaehe whaipainga, he CSS ritenga ranei hei tautuhi i to raatau whanui. - Ko
.progress-bar
te hiahia hoki etahirole
mearia
nga huanga kia uru atu ai.
Whakakotahitia tena, kei a koe nga tauira e whai ake nei.
<div class="progress">
<div class="progress-bar" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100"></div>
</div>
<div class="progress">
<div class="progress-bar" role="progressbar" style="width: 25%" aria-valuenow="25" aria-valuemin="0" aria-valuemax="100"></div>
</div>
<div class="progress">
<div class="progress-bar" role="progressbar" style="width: 50%" aria-valuenow="50" aria-valuemin="0" aria-valuemax="100"></div>
</div>
<div class="progress">
<div class="progress-bar" role="progressbar" style="width: 75%" aria-valuenow="75" aria-valuemin="0" aria-valuemax="100"></div>
</div>
<div class="progress">
<div class="progress-bar" role="progressbar" style="width: 100%" aria-valuenow="100" aria-valuemin="0" aria-valuemax="100"></div>
</div>
Ka whakaratohia e Bootstrap etahi taputapu mo te whakatakoto whanui . I runga i o hiahia, ka awhina pea enei ki te whirihora tere i te ahunga whakamua.
<div class="progress">
<div class="progress-bar w-75" role="progressbar" aria-valuenow="75" aria-valuemin="0" aria-valuemax="100"></div>
</div>
Tapanga
Tāpirihia nga tapanga ki o pae ahunga whakamua ma te whakatakoto kupu ki roto i te .progress-bar
.
<div class="progress">
<div class="progress-bar" role="progressbar" style="width: 25%;" aria-valuenow="25" aria-valuemin="0" aria-valuemax="100">25%</div>
</div>
Teitei
Ka whakatauhia e matou he height
uara ki runga i te .progress
, na ki te whakarereke koe i taua uara .progress-bar
ka huri aunoa te rahi o roto.
<div class="progress" style="height: 1px;">
<div class="progress-bar" role="progressbar" 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" style="width: 25%;" aria-valuenow="25" aria-valuemin="0" aria-valuemax="100"></div>
</div>
Papamuri
Whakamahia nga karaehe whaipainga papamuri hei whakarereke i te ahua o nga pae ahunga whakamua takitahi.
<div class="progress">
<div class="progress-bar bg-success" role="progressbar" 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" 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" 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" style="width: 100%" aria-valuenow="100" aria-valuemin="0" aria-valuemax="100"></div>
</div>
Pae maha
Whakauruhia nga pae whakamua maha ki roto i tetahi waahanga ahu whakamua ki te hiahia koe.
<div class="progress">
<div class="progress-bar" role="progressbar" style="width: 15%" aria-valuenow="15" aria-valuemin="0" aria-valuemax="100"></div>
<div class="progress-bar bg-success" role="progressbar" style="width: 30%" aria-valuenow="30" aria-valuemin="0" aria-valuemax="100"></div>
<div class="progress-bar bg-info" role="progressbar" style="width: 20%" aria-valuenow="20" aria-valuemin="0" aria-valuemax="100"></div>
</div>
Tāhekeheke
Taapirihia .progress-bar-striped
ki tetahi .progress-bar
ki te hoatu whiu ma te rōnaki CSS ki runga i te tae papamuri o te pae ahunga whakamua.
<div class="progress">
<div class="progress-bar progress-bar-striped" role="progressbar" 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" 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" 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" 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" style="width: 100%" aria-valuenow="100" aria-valuemin="0" aria-valuemax="100"></div>
</div>
Nga whiu pakiwaituhi
Ka taea hoki te whakakorikori i te rōnaki purepure. Taapirihia .progress-bar-animated
ki .progress-bar
te whakakorikori i nga whiu matau ki te maui ma te CSS3 pakiwaituhi.
<div class="progress">
<div class="progress-bar progress-bar-striped progress-bar-animated" role="progressbar" aria-valuenow="75" aria-valuemin="0" aria-valuemax="100" style="width: 75%"></div>
</div>
Sass
Taurangi
$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;
Papamatua
I whakamahia mo te hanga i nga pakiwaituhi CSS mo .progress-bar-animated
. Kei roto scss/_progress-bar.scss
.
@if $enable-transitions {
@keyframes progress-bar-stripes {
0% { background-position-x: $progress-height; }
}
}