Source

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 .progressmar phasgan gus an luach as motha den bhàr adhartais a chomharrachadh.
  • Cleachdaidh sinn an taobh a-staigh .progress-bargus an adhartas gu ruige seo a chomharrachadh.
  • Tha .progress-barfeum air stoidhle in-loidhne, clas goireis, no CSS àbhaisteach gus an leud a shuidheachadh.
  • Bidh .progress-barfeum cuideachd air cuid roleagus ariabuadhan 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.

25%
<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 heightluach air an .progress, mar sin ma dh'atharraicheas tu an luach sin thèid an taobh a-staigh .progress-barath-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-stripedri fear sam bith .progress-bargus 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-animatedris .progress-bargus 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>