Kosala ba paginations
Mikanda mpe bandakisa mpo na kolakisa nkasa mpo na kolakisa molɔngɔ́ ya makambo oyo etali yango ezali na kati ya nkasa mingi.
Tosalelaka bloc monene ya ba liens oyo ekangami mpo na pagination na biso, kosala ete ba liens ezala mpasi mpo na kozanga mpe ekoki ko évoluer na pete —nyonso wana ezali kopesa bisika minene ya kobeta. Pagination etongami na ba éléments HTML ya liste mpo batangi ya écran bakoka kosakola motango ya ba liens oyo ezali. Salelá eloko ya kokanga <nav>
mpo na koyeba yango lokola eteni ya kotambwisa mpo na batángi ya écran mpe mayele mosusu ya kosalisa.
En plus, lokola ba pages eza probablement na plus d'une section ya navigation ya boye, eza conseillé kopesa descriptif aria-label
pona ba pona <nav>
ko refleter but na yango. Na ndakisa, soki eteni ya pagination esalelami mpo na kotambola kati na ensemble ya ba résultats ya boluki, étiquette oyo ebongi ekoki kozala 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>
Ozali koluka kosalela elembo to elembo na esika ya makomi mpo na mwa ba liens ya pagination? Bozala sûr ya kopesa lisungi ya motángi ya écran oyo ebongi na ba aria
attributs mpe na .sr-only
utilitaire.
<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>
<span class="sr-only">Previous</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>
<span class="sr-only">Next</span>
</a>
</li>
</ul>
</nav>
Ba liens ya pagination ezali personnalisable pona ba circonstances différentes. Salelá .disabled
mpo na ba liens oyo emonani ete okoki kofina te mpe .active
mpo na komonisa lokasa oyo ozali kosalela.
Alors que .disabled
classe esalelaka pointer-events: none
pona koluka ko désactiver fonctionnalité ya lien ya <a>
s, propriété CSS wana eza nanu standardisé te pe ezo comptabiliser navigation ya clavier te. Lokola yango, osengeli ntango nyonso kobakisa tabindex="-1"
na ba liens oyo ekangami mpe kosalela JavaScript oyo esalemi na kolanda bamposa ya moto mpo na kokanga mosala na yango mobimba.
<nav aria-label="...">
<ul class="pagination">
<li class="page-item disabled">
<a class="page-link" href="#" tabindex="-1">Previous</a>
</li>
<li class="page-item"><a class="page-link" href="#">1</a></li>
<li class="page-item active">
<a class="page-link" href="#">2 <span class="sr-only">(current)</span></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>
Okoki na bolingi ya ko swap out ba ancres actifs to désactivés mpo na <span>
, to kotika anchor na cas ya ba flèches prév/next, mpo na kolongola fonctionnalité ya cliquage mpe kopekisa focus ya clavier tout en gardant ba styles oyo ekanamaki.
<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">
<span class="page-link">
2
<span class="sr-only">(current)</span>
</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>
Fancy pagination ya monene to ya moke? Bakisa .pagination-lg
to .pagination-sm
mpo na ba taille mosusu.
<nav aria-label="...">
<ul class="pagination pagination-lg">
<li class="page-item disabled">
<a class="page-link" href="#" tabindex="-1">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>
</ul>
</nav>
<nav aria-label="...">
<ul class="pagination pagination-sm">
<li class="page-item disabled">
<a class="page-link" href="#" tabindex="-1">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>
</ul>
</nav>
Bobongola alignment ya ba composants ya pagination na ba utilitaires flexbox .
<nav aria-label="Page navigation example">
<ul class="pagination justify-content-center">
<li class="page-item disabled">
<a class="page-link" href="#" tabindex="-1">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>
<nav aria-label="Page navigation example">
<ul class="pagination justify-content-end">
<li class="page-item disabled">
<a class="page-link" href="#" tabindex="-1">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>