Source

Spinners

Qhia txog lub xeev thauj khoom ntawm ib feem lossis nplooj ntawv nrog Bootstrap spinners, ua tiav nrog HTML, CSS, thiab tsis muaj JavaScript.

Txog

Bootstrap "spinners" tuaj yeem siv los qhia txog lub xeev thauj khoom hauv koj cov haujlwm. Lawv tsuas yog tsim nrog HTML thiab CSS, txhais tau tias koj tsis tas yuav muaj JavaScript los tsim lawv. Txawm li cas los xij, koj yuav xav tau qee qhov kev cai JavaScript los hloov lawv qhov pom. Lawv cov tsos, sib dhos, thiab qhov loj me tuaj yeem hloov kho tau yooj yim nrog peb cov chav kawm siv hluav taws xob zoo.

Rau kev siv tau yooj yim, txhua lub loader ntawm no suav nrog role="status"thiab ib qho zes <span class="sr-only">Loading...</span>.

Ciam teb spinner

Siv cov ciam teb spinners rau lub teeb yuag qhov taw qhia.

Loading...
<div class="spinner-border" role="status">
  <span class="sr-only">Loading...</span>
</div>

Xim

Tus ciam teb spinner siv currentColorrau nws border-color, txhais tau tias koj tuaj yeem kho cov xim nrog cov ntawv xim siv . Koj tuaj yeem siv ib qho ntawm peb cov ntawv siv xim xim ntawm tus qauv spinner.

Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
<div class="spinner-border text-primary" role="status">
  <span class="sr-only">Loading...</span>
</div>
<div class="spinner-border text-secondary" role="status">
  <span class="sr-only">Loading...</span>
</div>
<div class="spinner-border text-success" role="status">
  <span class="sr-only">Loading...</span>
</div>
<div class="spinner-border text-danger" role="status">
  <span class="sr-only">Loading...</span>
</div>
<div class="spinner-border text-warning" role="status">
  <span class="sr-only">Loading...</span>
</div>
<div class="spinner-border text-info" role="status">
  <span class="sr-only">Loading...</span>
</div>
<div class="spinner-border text-light" role="status">
  <span class="sr-only">Loading...</span>
</div>
<div class="spinner-border text-dark" role="status">
  <span class="sr-only">Loading...</span>
</div>

Vim li cas ho tsis siv cov khoom siv border-colorhluav taws xob? Txhua tus ciam teb spinner qhia txog transparentciam teb tsawg kawg yog ib sab, yog li .border-{color}kev siv hluav taws xob yuav hla dhau qhov ntawd.

Loj hlob spinner

Yog tias koj tsis nyiam tus ciam teb spinner, hloov mus rau qhov loj hlob spinner. Thaum nws tsis technically spin, nws pheej pheej loj hlob!

Loading...
<div class="spinner-grow" role="status">
  <span class="sr-only">Loading...</span>
</div>

Ib zaug ntxiv, qhov spinner no tau tsim nrog currentColor, yog li koj tuaj yeem hloov nws cov tsos nrog cov ntawv xim xim . Ntawm no nws yog xiav, nrog rau kev txhawb nqa variants.

Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
<div class="spinner-grow text-primary" role="status">
  <span class="sr-only">Loading...</span>
</div>
<div class="spinner-grow text-secondary" role="status">
  <span class="sr-only">Loading...</span>
</div>
<div class="spinner-grow text-success" role="status">
  <span class="sr-only">Loading...</span>
</div>
<div class="spinner-grow text-danger" role="status">
  <span class="sr-only">Loading...</span>
</div>
<div class="spinner-grow text-warning" role="status">
  <span class="sr-only">Loading...</span>
</div>
<div class="spinner-grow text-info" role="status">
  <span class="sr-only">Loading...</span>
</div>
<div class="spinner-grow text-light" role="status">
  <span class="sr-only">Loading...</span>
</div>
<div class="spinner-grow text-dark" role="status">
  <span class="sr-only">Loading...</span>
</div>

Kev sib tw

Spinners hauv Bootstrap yog tsim nrog rems, currentColor, thiab display: inline-flex. Qhov no txhais tau hais tias lawv tuaj yeem hloov pauv tau yooj yim, hloov kho dua tshiab, thiab nrawm nrawm.

Margin

Siv cov khoom siv margin zoo li .m-5kom yooj yim sib nrug.

Loading...
<div class="spinner-border m-5" role="status">
  <span class="sr-only">Loading...</span>
</div>

Qhov chaw

Siv flexbox utilities , float utilities , lossis text alignment utilities los tso cov spinners raws nraim qhov koj xav tau nyob rau txhua qhov xwm txheej.

Flex

Loading...
<div class="d-flex justify-content-center">
  <div class="spinner-border" role="status">
    <span class="sr-only">Loading...</span>
  </div>
</div>
Loading...
<div class="d-flex align-items-center">
  <strong>Loading...</strong>
  <div class="spinner-border ml-auto" role="status" aria-hidden="true"></div>
</div>

ntab

Loading...
<div class="clearfix">
  <div class="spinner-border float-right" role="status">
    <span class="sr-only">Loading...</span>
  </div>
</div>

Text align

Loading...
<div class="text-center">
  <div class="spinner-border" role="status">
    <span class="sr-only">Loading...</span>
  </div>
</div>

Loj

Ntxiv .spinner-border-smthiab .spinner-grow-smua kom me me spinner tuaj yeem siv tau sai hauv lwm cov khoom.

Loading...
Loading...
<div class="spinner-border spinner-border-sm" role="status">
  <span class="sr-only">Loading...</span>
</div>
<div class="spinner-grow spinner-grow-sm" role="status">
  <span class="sr-only">Loading...</span>
</div>

Los yog, siv kev cai CSS lossis inline styles hloov qhov ntev raws li xav tau.

Loading...
Loading...
<div class="spinner-border" style="width: 3rem; height: 3rem;" role="status">
  <span class="sr-only">Loading...</span>
</div>
<div class="spinner-grow" style="width: 3rem; height: 3rem;" role="status">
  <span class="sr-only">Loading...</span>
</div>

Khawm

Siv cov spinners hauv cov nyees khawm los qhia tias qhov kev txiav txim tam sim no tab tom ua lossis ua qhov chaw. Koj tuaj yeem hloov cov ntawv tawm ntawm lub caij spinner thiab siv khawm ntawv raws li xav tau.

<button class="btn btn-primary" type="button" disabled>
  <span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>
  <span class="sr-only">Loading...</span>
</button>
<button class="btn btn-primary" type="button" disabled>
  <span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>
  Loading...
</button>
<button class="btn btn-primary" type="button" disabled>
  <span class="spinner-grow spinner-grow-sm" role="status" aria-hidden="true"></span>
  <span class="sr-only">Loading...</span>
</button>
<button class="btn btn-primary" type="button" disabled>
  <span class="spinner-grow spinner-grow-sm" role="status" aria-hidden="true"></span>
  Loading...
</button>