Pej dɛn we dɛn rayt
Dokumɛnt ɛn ɛgzampul dɛn fɔ sho pej fɔ sho se wan siriɔs tin we gɛt fɔ du wit dis de akɔdin to bɔku pej dɛn.
Ɔvaviu fɔ di Baybul
Wi de yuz wan big blɔk we gɛt kɔnɛkt link fɔ wi pej, we de mek link dɛn at fɔ mis ɛn izi fɔ skel—ɔl dis de gi big hit eria dɛn. Dɛn bil pejeshɔn wit list HTML ɛlimɛnt dɛn so dat di wan dɛn we de rid di skrin go ebul fɔ anɔys di nɔmba fɔ di link dɛn we de. Yuz wan wrap <nav>
ɛlimɛnt fɔ no am as nevigishɔn sɛkshɔn fɔ skrin rida ɛn ɔda ɛtɛknɔlɔji dɛn we de ɛp.
Apat frɔm dat, bikɔs i go mɔs bi se pej dɛn gɛt mɔ pas wan pat pan dɛn kayn nevigishɔn sɛkshɔn dɛn de, i fayn fɔ gi wan diskrɔtif aria-label
fɔ di <nav>
fɔ sho wetin i want fɔ du. Fɔ ɛgzampul, if dɛn yuz di pej pat fɔ go bitwin wan sɛt fɔ di tin dɛn we dɛn dɔn fɛn, wan rayt lɛbl kin bi aria-label="Search results pages"
.
<nav aria-label="Page navigation example">
<ul class="pagination">
<li class="page-item"><a class="page-link" href="#">Previous</a></li>
<li class="page-item"><a class="page-link" href="#">1</a></li>
<li class="page-item"><a class="page-link" href="#">2</a></li>
<li class="page-item"><a class="page-link" href="#">3</a></li>
<li class="page-item"><a class="page-link" href="#">Next</a></li>
</ul>
</nav>
We yu de wok wit aykɔn dɛn
Yu de luk fɔ yuz aykɔn ɔ simbul insay di ples fɔ tɛks fɔ sɔm pej link dɛn? Mek shɔ se yu gi di rayt skrin rida sɔpɔt wit aria
atribyut dɛn.
<nav aria-label="Page navigation example">
<ul class="pagination">
<li class="page-item">
<a class="page-link" href="#" aria-label="Previous">
<span aria-hidden="true">«</span>
</a>
</li>
<li class="page-item"><a class="page-link" href="#">1</a></li>
<li class="page-item"><a class="page-link" href="#">2</a></li>
<li class="page-item"><a class="page-link" href="#">3</a></li>
<li class="page-item">
<a class="page-link" href="#" aria-label="Next">
<span aria-hidden="true">»</span>
</a>
</li>
</ul>
</nav>
Disabled ɛn aktif stet dɛn
Pejin link dɛn kin kɔstɔmayt fɔ difrɛn tin dɛn. Yuz .disabled
fɔ link dɛn we tan lɛk se yu nɔ go ebul fɔ klik ɛn .active
fɔ sho di pej we yu de yuz naw.
Wail di .disabled
klas de yuz pointer-events: none
fɔ tray fɔ disable di link funkshɔnaliti fɔ <a>
s, da CSS prɔpati de nɔ standad yet ɛn i nɔ de akɔn fɔ kibɔd nevigishɔn. As a so, yu fɔ ad ɔltɛm tabindex="-1"
pan link dɛn we nɔ de wok ɛn yuz kɔstɔm JavaSkript fɔ fulɔp fɔ disable dɛn wok.
<nav aria-label="...">
<ul class="pagination">
<li class="page-item disabled">
<a class="page-link">Previous</a>
</li>
<li class="page-item"><a class="page-link" href="#">1</a></li>
<li class="page-item active" aria-current="page">
<a class="page-link" href="#">2</a>
</li>
<li class="page-item"><a class="page-link" href="#">3</a></li>
<li class="page-item">
<a class="page-link" href="#">Next</a>
</li>
</ul>
</nav>
Yu kin opshɔnali swap aut aktif ɔ disabled ankɔ dɛn fɔ <span>
, ɔ ɔmit di anka insay di kes fɔ di prɛv/nɛks aro dɛn, fɔ pul di klik funkshɔnaliti ɛn fɔ mek di kibɔd nɔ pe atɛnshɔn we yu de kip di stayl dɛn we yu want.
<nav aria-label="...">
<ul class="pagination">
<li class="page-item disabled">
<span class="page-link">Previous</span>
</li>
<li class="page-item"><a class="page-link" href="#">1</a></li>
<li class="page-item active" aria-current="page">
<span class="page-link">2</span>
</li>
<li class="page-item"><a class="page-link" href="#">3</a></li>
<li class="page-item">
<a class="page-link" href="#">Next</a>
</li>
</ul>
</nav>
Sayz fɔ di sayz
Fans big ɔ smɔl pejineshɔn? Ad .pagination-lg
ɔ .pagination-sm
fɔ ɔda saiz dɛn.
<nav aria-label="...">
<ul class="pagination pagination-lg">
<li class="page-item active" aria-current="page">
<span class="page-link">1</span>
</li>
<li class="page-item"><a class="page-link" href="#">2</a></li>
<li class="page-item"><a class="page-link" href="#">3</a></li>
</ul>
</nav>
<nav aria-label="...">
<ul class="pagination pagination-sm">
<li class="page-item active" aria-current="page">
<span class="page-link">1</span>
</li>
<li class="page-item"><a class="page-link" href="#">2</a></li>
<li class="page-item"><a class="page-link" href="#">3</a></li>
</ul>
</nav>
Alignmɛnt fɔ di wan dɛn we de
Chenj di alaynɛshɔn fɔ pejin kɔmpɔnɛnt dɛn wit fleksbɔks yutiliti dɛn . Fɔ ɛgzampul, wit .justify-content-center
:
<nav aria-label="Page navigation example">
<ul class="pagination justify-content-center">
<li class="page-item disabled">
<a class="page-link">Previous</a>
</li>
<li class="page-item"><a class="page-link" href="#">1</a></li>
<li class="page-item"><a class="page-link" href="#">2</a></li>
<li class="page-item"><a class="page-link" href="#">3</a></li>
<li class="page-item">
<a class="page-link" href="#">Next</a>
</li>
</ul>
</nav>
Ɔ wit .justify-content-end
: .
<nav aria-label="Page navigation example">
<ul class="pagination justify-content-end">
<li class="page-item disabled">
<a class="page-link">Previous</a>
</li>
<li class="page-item"><a class="page-link" href="#">1</a></li>
<li class="page-item"><a class="page-link" href="#">2</a></li>
<li class="page-item"><a class="page-link" href="#">3</a></li>
<li class="page-item">
<a class="page-link" href="#">Next</a>
</li>
</ul>
</nav>
CSS we dɛn kɔl CSS
Di tin dɛn we kin chenj
Dɛn ad am na v5.2.0As pat pan Bootstrap in evolvin CSS variebul aprɔch, pejin naw de yuz lokal CSS vɛriɔbul dɛn on .pagination
fɔ ɛnhans rial-taym kɔstɔmayshɔn. Valyu fɔ di CSS vɛriɔbul dɛn de sɛt via Sass, so Sass kɔstɔmayshɔn stil de sɔpɔt, bak.
--#{$prefix}pagination-padding-x: #{$pagination-padding-x};
--#{$prefix}pagination-padding-y: #{$pagination-padding-y};
@include rfs($pagination-font-size, --#{$prefix}pagination-font-size);
--#{$prefix}pagination-color: #{$pagination-color};
--#{$prefix}pagination-bg: #{$pagination-bg};
--#{$prefix}pagination-border-width: #{$pagination-border-width};
--#{$prefix}pagination-border-color: #{$pagination-border-color};
--#{$prefix}pagination-border-radius: #{$pagination-border-radius};
--#{$prefix}pagination-hover-color: #{$pagination-hover-color};
--#{$prefix}pagination-hover-bg: #{$pagination-hover-bg};
--#{$prefix}pagination-hover-border-color: #{$pagination-hover-border-color};
--#{$prefix}pagination-focus-color: #{$pagination-focus-color};
--#{$prefix}pagination-focus-bg: #{$pagination-focus-bg};
--#{$prefix}pagination-focus-box-shadow: #{$pagination-focus-box-shadow};
--#{$prefix}pagination-active-color: #{$pagination-active-color};
--#{$prefix}pagination-active-bg: #{$pagination-active-bg};
--#{$prefix}pagination-active-border-color: #{$pagination-active-border-color};
--#{$prefix}pagination-disabled-color: #{$pagination-disabled-color};
--#{$prefix}pagination-disabled-bg: #{$pagination-disabled-bg};
--#{$prefix}pagination-disabled-border-color: #{$pagination-disabled-border-color};
Sass di vayriɔbul dɛn
$pagination-padding-y: .375rem;
$pagination-padding-x: .75rem;
$pagination-padding-y-sm: .25rem;
$pagination-padding-x-sm: .5rem;
$pagination-padding-y-lg: .75rem;
$pagination-padding-x-lg: 1.5rem;
$pagination-font-size: $font-size-base;
$pagination-color: var(--#{$prefix}link-color);
$pagination-bg: $white;
$pagination-border-radius: $border-radius;
$pagination-border-width: $border-width;
$pagination-margin-start: ($pagination-border-width * -1);
$pagination-border-color: $gray-300;
$pagination-focus-color: var(--#{$prefix}link-hover-color);
$pagination-focus-bg: $gray-200;
$pagination-focus-box-shadow: $input-btn-focus-box-shadow;
$pagination-focus-outline: 0;
$pagination-hover-color: var(--#{$prefix}link-hover-color);
$pagination-hover-bg: $gray-200;
$pagination-hover-border-color: $gray-300;
$pagination-active-color: $component-active-color;
$pagination-active-bg: $component-active-bg;
$pagination-active-border-color: $pagination-active-bg;
$pagination-disabled-color: $gray-600;
$pagination-disabled-bg: $white;
$pagination-disabled-border-color: $gray-300;
$pagination-transition: color .15s ease-in-out, background-color .15s ease-in-out, border-color .15s ease-in-out, box-shadow .15s ease-in-out;
$pagination-border-radius-sm: $border-radius-sm;
$pagination-border-radius-lg: $border-radius-lg;
Sass miksin dɛn
@mixin pagination-size($padding-y, $padding-x, $font-size, $border-radius) {
--#{$prefix}pagination-padding-x: #{$padding-x};
--#{$prefix}pagination-padding-y: #{$padding-y};
@include rfs($font-size, --#{$prefix}pagination-font-size);
--#{$prefix}pagination-border-radius: #{$border-radius};
}