Menu
×
   ❮     
HTML CSS JAVASCRIPT SQL PYTHON JAVA PHP C C++ C# AWS W3.CSS HOW TO BOOTSTRAP REACT MYSQL JQUERY EXCEL XML DJANGO NUMPY PANDAS NODEJS DSA TYPESCRIPT ANGULAR ANGULARJS GIT POSTGRESQL MONGODB ASP AI R GO KOTLIN SWIFT SASS VUE GEN AI SCIPY CYBERSECURITY DATA SCIENCE INTRO TO PROGRAMMING INTRO TO HTML & CSS BASH RUST TOOLS

W3.CSS Pagination

Share

What is Pagination?

Pagination is the process of dividing larger data into smaller, discrete pages.

W3.CSS uses bars and buttons to create simple pagination controls.

« 1 2 3 4 5 6 »

Pagination Classes

Use w3-bar to group the pagination links.

Add w3-button to make the links look like buttons:

Example

<div class="w3-bar">
  <a href="#" class="w3-button">1</a>
  <a href="#" class="w3-button">2</a>
  <a href="#" class="w3-button">3</a>
  <a href="#" class="w3-button">4</a>
  <a href="#" class="w3-button">5</a>
</div>

Try It Yourself »

Add w3-bar-item to remove the space between the buttons:

Example

<div class="w3-bar">
  <a href="#" class="w3-bar-item w3-button">&laquo;</a>
  <a href="#" class="w3-bar-item w3-button">1</a>
  <a href="#" class="w3-bar-item w3-button">2</a>
  <a href="#" class="w3-bar-item w3-button">3</a>
  <a href="#" class="w3-bar-item w3-button">4</a>
  <a href="#" class="w3-bar-item w3-button">5</a>
  <a href="#" class="w3-bar-item w3-button">&raquo;</a>
</div>

Try It Yourself »


Pagination Arrows

Use HTML entities or icons to add previous and next arrows:

« 1 2 3 4 »

Example

<div class="w3-bar">
  <a href="#" class="w3-button">&laquo;</a>
  <a href="#" class="w3-button">1</a>
  <a href="#" class="w3-button">2</a>
  <a href="#" class="w3-button">3</a>
  <a href="#" class="w3-button">4</a>
  <a href="#" class="w3-button">&raquo;</a>
</div>

Try It Yourself »


Active Page

Add a w3-color class to highlight the current page:

« 1 2 3 4 »

Example

<div class="w3-bar">
  <a href="#" class="w3-button">&laquo;</a>
  <a href="#" class="w3-button w3-green">1</a>
  <a href="#" class="w3-button">2</a>
  <a href="#" class="w3-button">3</a>
  <a href="#" class="w3-button">4</a>
  <a href="#" class="w3-button">&raquo;</a>
</div>

Try It Yourself »



Hover Colors

Use a w3-hover-color class to change the hover color:

« 1 2 3 4 »

Example

<div class="w3-bar">
  <a href="#" class="w3-button w3-hover-purple">&laquo;</a>
  <a href="#" class="w3-button w3-hover-green">1</a>
  <a href="#" class="w3-button w3-hover-red">2</a>
  <a href="#" class="w3-button w3-hover-blue">3</a>
  <a href="#" class="w3-button w3-hover-black">4</a>
  <a href="#" class="w3-button w3-hover-orange">&raquo;</a>
</div>

Try It Yourself »


Pagination Size

Use W3.CSS size classes such as w3-small, w3-large, and w3-xlarge to change the size:

« 1 2 3 4 »
« 1 2 3 4 »

Example

<div class="w3-bar w3-xlarge">
  ...
</div>

Try It Yourself »


Centered Pagination

Place the w3-bar inside a w3-center element to center the pagination:

« 1 2 3 4 »

Example

<div class="w3-center w3-bar">
  <a href="#" class="w3-button">&laquo;</a>
  <a href="#" class="w3-button">1</a>
  <a href="#" class="w3-button">2</a>
  <a href="#" class="w3-button">3</a>
  <a href="#" class="w3-button">4</a>
  <a href="#" class="w3-button">&raquo;</a>
</div>

Try It Yourself »


Bordered Pagination

Add w3-border to create a border around the pagination:

« 1 2 3 4 5 »

Example

<div class="w3-bar w3-border">
  ...
</div>

Try It Yourself »

Rounded Borders

Add w3-round together with w3-border for rounded borders:

« 1 2 3 4 5 »

Example

<div class="w3-bar w3-border w3-round">
  ...
</div>

Try It Yourself »


Previous and Next

The w3-bar class can also be used for previous and next navigation:

Example

<div class="w3-bar w3-border w3-round">
  <a href="#" class="w3-button">&#10094; Previous</a>
  <a href="#" class="w3-button w3-right">Next &#10095;</a>
</div>

Try It Yourself »


×

Contact Sales

If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail:
sales@w3schools.com

Report Error

If you want to report an error, or if you want to make a suggestion, send us an e-mail:
help@w3schools.com

W3Schools is optimized for learning and training. Examples might be simplified to improve reading and learning. Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness of all content. While using W3Schools, you agree to have read and accepted our terms of use, cookies and privacy policy.

Copyright 1999-2026 by Refsnes Data. All Rights Reserved. W3Schools is Powered by W3.CSS.