Adhartas
Sgrìobhainnean agus eisimpleirean airson a bhith a’ cleachdadh bhàraichean adhartais àbhaisteach Bootstrap le taic airson bàraichean air an càrnadh, cùl-raointean beòthail, agus bileagan teacsa.
Mar a tha e ag obair
Tha co-phàirtean adhartais air an togail le dà eileamaid HTML, cuid de CSS gus an leud a shuidheachadh, agus beagan fheartan. Cha bhith sinn a’ cleachdadh an eileamaid HTML5<progress>
, a’ dèanamh cinnteach gun urrainn dhut bàraichean adhartais a chruachadh, am beothachadh, agus bileagan teacsa a chuir thairis orra.
- Bidh sinn a’ cleachdadh an
.progress
mar phasgan gus an luach as motha den bhàr adhartais a chomharrachadh. - Cleachdaidh sinn an taobh a-staigh
.progress-bar
gus an adhartas gu ruige seo a chomharrachadh. - Tha
.progress-bar
feum air stoidhle in-loidhne, clas goireis, no CSS àbhaisteach gus an leud a shuidheachadh. - Bidh
.progress-bar
feum cuideachd air cuidrole
agusaria
buadhan gus a dhèanamh ruigsinneach.
Cuir sin uile ri chèile, agus tha na h-eisimpleirean a leanas agad.
<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>
Bidh Bootstrap a’ toirt seachad dòrlach de ghoireasan airson leud a shuidheachadh . A rèir do fheumalachdan, dh’ fhaodadh iad sin cuideachadh le bhith a’ rèiteachadh adhartas gu sgiobalta.
<div class="progress">
<div class="progress-bar w-75" role="progressbar" aria-valuenow="75" aria-valuemin="0" aria-valuemax="100"></div>
</div>
Bileagan
Cuir bileagan ris na bàraichean adhartais agad le bhith a’ cur teacsa taobh a-staigh an fhaidhle .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>
Àirde
Cha chuir sinn ach height
luach air an .progress
, mar sin ma dh'atharraicheas tu an luach sin thèid an taobh a-staigh .progress-bar
ath-mheudachadh gu fèin-obrachail a rèir sin.
<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>
Cùl-fhiosrachadh
Cleachd clasaichean cùl-fhiosrachaidh gus coltas bhàraichean adhartais fa leth atharrachadh.
<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>
Ioma bàraichean
Cuir a-steach grunn bhàraichean adhartais ann am pàirt adhartais ma tha feum agad air.
<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>
Air a stialladh
Cuir .progress-bar-striped
ri fear sam bith .progress-bar
gus stripe a chuir an sàs tro chaise CSS thairis air dath cùl a’ bhàr adhartais.
<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>
Stripes beòthail
Faodar an caisead stiallach a bheothachadh cuideachd. Cuir .progress-bar-animated
ris .progress-bar
gus na stiallan a bheothachadh deas gu clì tro bheòthachaidhean CSS3.
<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
Caochlaidhean
$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
Air a chleachdadh airson beòthachaidhean CSS a chruthachadh airson .progress-bar-animated
. Air a ghabhail a-steach ann an scss/_progress-bar.scss
.
@if $enable-transitions {
@keyframes progress-bar-stripes {
0% { background-position-x: $progress-height; }
}
}