Open In App

CSS Pagination

Last Updated : 21 Jul, 2023
Summarize
Comments
Improve
Suggest changes
Like Article
Like
Save
Share
Report
News Follow

Pagination is the process of dividing the document into pages and providing them with numbers. 

Types of Pagination: There are many types of pagination in CSS. Some of them are given below:

  1. Simple Pagination
  2. Active and Hoverable Pagination
  3. Rounded Active and Hoverable Buttons
  4. Hoverable Transition Effect
  5. Bordered Pagination
  6. Rounded Border Pagination
  7. Centered Pagination
  8. Space between Pagination
  9. Pagination Size

Simple Pagination: This is the basic form of pagination. 

Syntax:

.pagination {
display:type
}
.pagination body {
color:colorname
decoration:type
}

Example: This example shows the use of CSS Pagination.

html




<!DOCTYPE html>
<html>
<head>
    <style>
        .pagination {
            display: inline-block;
        }
 
        .pagination a {
            font-weight: bold;
            font-size: 20px;
            color: black;
            float: left;
            padding: 8px 16px;
            text-decoration: none;
        }
 
        .GFG {
            font-size: 42px;
            font-weight: bold;
            color: #009900;
            margin-left: 100px;
            margin-bottom: 60px;
        }
 
        .peg {
            font-size: 24px;
            font-weight: bold;
            margin-left: 140px;
        }
    </style>
</head>
 
<body>
    <div class="GFG">GeeksforGeeks</div>
    <div class="peg">Simple Pagination</div>
    <div class="pagination">
        <a href="#">«</a>
        <a href="#">1</a>
        <a href="#">2</a>
        <a href="#">3</a>
        <a href="#">4</a>
        <a href="#">5</a>
        <a href="#">6</a>
        <a href="#">7</a>
        <a href="#">8</a>
        <a href="#">9</a>
        <a href="#">10</a>
        <a href="#">»</a>
    </div>
</body>
</html>


Output:

simple pagination Active and Hoverable Pagination: In this pagination, by using the active class the current page will be highlighted. Hover will change the color of the page link when the mouse moves over them. 

Syntax:

.pagination body.active {
display:type
background-color:colorname
}
.pagination body:hover:not(.active) {
background-color:colorname
}

Example: This example shows the use of CSS Pagination.

html




<!DOCTYPE html>
<html>
<head>
    <style>
        .pagination {
            display: inline-block;
        }
 
        .pagination a {
            font-weight: bold;
            font-size: 20px;
            color: black;
            float: left;
            padding: 8px 16px;
            text-decoration: none;
        }
 
        .pagination a.active {
            background-color: #009900;
        }
 
        .pagination a:hover:not(.active) {
            background-color: #d4d5d2;
        }
 
        .GFG {
            font-size: 42px;
            font-weight: bold;
            color: #009900;
            margin-left: 100px;
            margin-bottom: 60px;
        }
 
        .peg {
            font-size: 24px;
            font-weight: bold;
            margin-left: 90px;
            margin-bottom: 20px;
        }
    </style>
</head>
 
<body>
 
    <div class="GFG">GeeksforGeeks</div>
    <div class="peg">Active and Hoverable Pagination</div>
    <div class="pagination">
        <a href="#">«</a>
        <a href="#">1</a>
        <a href="#">2</a>
        <a href="#">3</a>
        <a href="#">4</a>
        <a class="active" href="#">5</a>
        <a href="#">6</a>
        <a href="#">7</a>
        <a href="#">8</a>
        <a href="#">9</a>
        <a href="#">10</a>
        <a href="#">»</a>
    </div>
 
</body>
</html>


Output: active paginationRounded Active and Hoverable Buttons: For rounded active and hoverable buttons just add border-radius property. 

Syntax:

.pagination body.active {
display:type
background-color:colorname
border-radius:size
}
.pagination body:hover:not(.active) {
background-color:colorname
border-radius:size
}

Example: This example shows the use of CSS Pagination.

html




<!DOCTYPE html>
<html>
<head>
    <style>
        .pagination {
            display: inline-block;
        }
 
        .pagination a {
            font-weight: bold;
            font-size: 20px;
            color: black;
            float: left;
            padding: 8px 16px;
            text-decoration: none;
        }
 
        .pagination a.active {
            border-radius: 5px;
            background-color: #009900;
        }
 
        .pagination a:hover:not(.active) {
            background-color: #d4d5d2;
            border-radius: 5px;
        }
 
        .GFG {
            font-size: 42px;
            font-weight: bold;
            color: #009900;
            margin-left: 100px;
            margin-bottom: 60px;
        }
 
        .peg {
            font-size: 24px;
            font-weight: bold;
            margin-left: 40px;
            margin-bottom: 20px;
        }
    </style>
</head>
 
<body>
 
    <div class="GFG">GeeksforGeeks</div>
    <div class="peg">Rounded Active and Hoverable Pagination</div>
    <div class="pagination">
        <a href="#">«</a>
        <a href="#">1</a>
        <a href="#">2</a>
        <a href="#">3</a>
        <a href="#">4</a>
        <a class="active" href="#">5</a>
        <a href="#">6</a>
        <a href="#">7</a>
        <a href="#">8</a>
        <a href="#">9</a>
        <a href="#">10</a>
        <a href="#">»</a>
    </div>
 
</body>
</html>


Output: rounded and active paginationHoverable Transition Effect: Transition property is added to create a transition effect on hover. 

Syntax:

.pagination body:hover {
transition:type
}

Example: This example shows the use of CSS Pagination.

html




<!DOCTYPE html>
<html>
 
<head>
    <style>
        .pagination {
            display: inline-block;
        }
 
        .pagination a {
            font-weight: bold;
            font-size: 20px;
            color: black;
            float: left;
            padding: 8px 16px;
            text-decoration: none;
        }
 
        .pagination a.active {
            background-color: #009900;
        }
 
        .pagination a:hover:not(.active) {
            background-color: #d4d5d2;
        }
 
        .GFG {
            font-size: 42px;
            font-weight: bold;
            color: #009900;
            margin-left: 100px;
            margin-bottom: 60px;
        }
 
        .peg {
            font-size: 24px;
            font-weight: bold;
            margin-left: 40px;
            margin-bottom: 20px;
        }
    </style>
</head>
 
<body>
 
    <div class="GFG">GeeksforGeeks</div>
    <div class="peg">Hoverable Transition Effect Pagination</div>
    <div class="pagination">
        <a href="#">«</a>
        <a href="#">1</a>
        <a href="#">2</a>
        <a href="#">3</a>
        <a href="#">4</a>
        <a class="active" href="#">5</a>
        <a href="#">6</a>
        <a href="#">7</a>
        <a href="#">8</a>
        <a href="#">9</a>
        <a href="#">10</a>
        <a href="#">»</a>
    </div>
 
</body>
</html>


Output: hover transition effectBordered Pagination: In this type of pagination a border is added to the pagination. Use border property to add borders to the pagination. 

Syntax:

.pagination body {
border:type
}

Example: This example shows the use of CSS Pagination.

html




<!DOCTYPE html>
<html>
<head>
    <style>
        .pagination {
            display: inline-block;
        }
 
        .pagination a {
            font-weight: bold;
            font-size: 20px;
            color: black;
            float: left;
            padding: 8px 16px;
            text-decoration: none;
            border: 1px solid black;
        }
 
        .pagination a.active {
            background-color: #009900;
        }
 
        .pagination a:hover:not(.active) {
            background-color: #d4d5d2;
        }
 
        .GFG {
            font-size: 42px;
            font-weight: bold;
            color: #009900;
            margin-left: 100px;
            margin-bottom: 60px;
        }
 
        .peg {
            font-size: 24px;
            font-weight: bold;
            margin-left: 140px;
            margin-bottom: 20px;
        }
    </style>
</head>
 
<body>
 
    <div class="GFG">GeeksforGeeks</div>
    <div class="peg">Bordered Pagination</div>
    <div class="pagination">
        <a href="#">«</a>
        <a href="#">1</a>
        <a href="#">2</a>
        <a href="#">3</a>
        <a href="#">4</a>
        <a class="active" href="#">5</a>
        <a href="#">6</a>
        <a href="#">7</a>
        <a href="#">8</a>
        <a href="#">9</a>
        <a href="#">10</a>
        <a href="#">»</a>
    </div>
 
</body>
</html>


Output: bordered paginationRounded Border Pagination: The border can be rounded using border-radius property. 

Syntax:

.pagination body {
border:type
border-radius:size
}

Example: This example shows the use of CSS Pagination.

html




<!DOCTYPE html>
<html>
<head>
    <style>
        .pagination {
            display: inline-block;
        }
 
        .pagination a {
            font-weight: bold;
            font-size: 20px;
            color: black;
            float: left;
            padding: 8px 16px;
            text-decoration: none;
            border-radius: 5px;
            border: 1px solid black;
        }
 
        .pagination a.active {
            background-color: #009900;
        }
 
        .pagination a:hover:not(.active) {
            background-color: #d4d5d2;
        }
 
        .GFG {
            font-size: 42px;
            font-weight: bold;
            color: #009900;
            margin-left: 100px;
            margin-bottom: 60px;
        }
 
        .peg {
            font-size: 24px;
            font-weight: bold;
            margin-left: 110px;
            margin-bottom: 20px;
        }
    </style>
</head>
 
<body>
 
    <div class="GFG">GeeksforGeeks</div>
    <div class="peg">Rounded Border Pagination</div>
    <div class="pagination">
        <a href="#">«</a>
        <a href="#">1</a>
        <a href="#">2</a>
        <a href="#">3</a>
        <a href="#">4</a>
        <a class="active" href="#">5</a>
        <a href="#">6</a>
        <a href="#">7</a>
        <a href="#">8</a>
        <a href="#">9</a>
        <a href="#">10</a>
        <a href="#">»</a>
    </div>
 
</body>
</html>


Output:

rounded border paginationCentered Pagination: Pagination can be centered by using text-align property. 

Syntax:

.center {
text-align:center
}
.pagination body {
color:colorname
}

Example: This example shows the use of CSS Pagination.

html




<!DOCTYPE html>
<html>
<head>
    <style>
        .pagination {
            display: inline-block;
        }
 
        .center {
            text-align: center;
        }
 
        .pagination a {
            font-weight: bold;
            font-size: 20px;
            color: black;
            float: left;
            padding: 8px 16px;
            text-decoration: none;
            border: 1px solid black;
        }
 
        .pagination a.active {
            background-color: #009900;
        }
 
        .pagination a:hover:not(.active) {
            background-color: #d4d5d2;
        }
 
        .GFG {
            font-size: 42px;
            font-weight: bold;
            color: #009900;
            text-align: center;
            margin-bottom: 60px;
        }
 
        .peg {
            font-size: 24px;
            font-weight: bold;
            margin-bottom: 20px;
            text-align: center;
        }
    </style>
</head>
 
<body>
 
    <div class="GFG">GeeksforGeeks</div>
    <div class="peg">Centered Pagination</div>
    <div class="center">
        <div class="pagination">
            <a href="#">«</a>
            <a href="#">1</a>
            <a href="#">2</a>
            <a href="#">3</a>
            <a href="#">4</a>
            <a class="active" href="#">5</a>
            <a href="#">6</a>
            <a href="#">7</a>
            <a href="#">8</a>
            <a href="#">9</a>
            <a href="#">10</a>
            <a href="#">»</a>
        </div>
    </div>
 
</body>
</html>


Output: centered paginationSpace Between Pagination: Page links can be spaced if you do not want to group them. Use the margin property to provide space between the links. 

Syntax:

.pagination body {
color:colorname
margin:type
}

Example: This example shows the use of CSS Pagination.

html




<!DOCTYPE html>
<html>
<head>
    <style>
        .pagination {
            display: inline-block;
        }
 
        .center {
            text-align: center;
        }
 
        .pagination a {
            font-weight: bold;
            font-size: 20px;
            color: black;
            float: left;
            margin: 0px 5px;
            padding: 8px 16px;
            text-decoration: none;
            border: 1px solid black;
        }
 
        .pagination a.active {
            background-color: #009900;
        }
 
        .pagination a:hover:not(.active) {
            background-color: #d4d5d2;
        }
 
        .GFG {
            font-size: 42px;
            font-weight: bold;
            color: #009900;
            text-align: center;
            margin-bottom: 60px;
        }
 
        .peg {
            font-size: 24px;
            font-weight: bold;
            margin-bottom: 20px;
            text-align: center;
        }
    </style>
</head>
 
<body>
 
    <div class="GFG">GeeksforGeeks</div>
    <div class="peg">Space Between Pagination</div>
    <div class="center">
        <div class="pagination">
            <a href="#">«</a>
            <a href="#">1</a>
            <a href="#">2</a>
            <a href="#">3</a>
            <a href="#">4</a>
            <a class="active" href="#">5</a>
            <a href="#">6</a>
            <a href="#">7</a>
            <a href="#">8</a>
            <a href="#">9</a>
            <a href="#">10</a>
            <a href="#">»</a>
        </div>
    </div>
 
</body>
</html>


Output: space between paginationPagination Size: The size of the pagination can be changed using the font-size property. 

Syntax:

.pagination body {
color:colorname
font-size:size
}

Example: This example shows the use of CSS Pagination.

html




<!DOCTYPE html>
<html>
<head>
    <style>
        .pagination {
            display: inline-block;
        }
 
        .center {
            text-align: center;
        }
 
        .pagination a {
            font-weight: bold;
            font-size: 25px;
            color: black;
            float: left;
            padding: 8px 16px;
            text-decoration: none;
            border: 1px solid black;
        }
 
        .pagination a.active {
            background-color: #009900;
        }
 
        .pagination a:hover:not(.active) {
            background-color: #d4d5d2;
        }
 
        .GFG {
            font-size: 42px;
            font-weight: bold;
            color: #009900;
            text-align: center;
            margin-bottom: 60px;
        }
 
        .peg {
            font-size: 24px;
            font-weight: bold;
            margin-bottom: 20px;
            text-align: center;
        }
    </style>
</head>
 
<body>
 
    <div class="GFG">GeeksforGeeks</div>
    <div class="peg">Pagination Size</div>
    <div class="center">
        <div class="pagination">
            <a href="#">«</a>
            <a href="#">1</a>
            <a href="#">2</a>
            <a href="#">3</a>
            <a href="#">4</a>
            <a class="active" href="#">5</a>
            <a href="#">6</a>
            <a href="#">7</a>
            <a href="#">8</a>
            <a href="#">9</a>
            <a href="#">10</a>
            <a href="#">»</a>
        </div>
    </div>
 
</body>
</html>


Output:

pagination size



Previous Article
Next Article

Similar Reads

Primer CSS Previous/Next Pagination
Primer CSS is a free open-source CSS framework that is built upon systems that create the foundation of the basic style elements such as spacing, typography, and color. This systematic method makes sure our patterns are steady and interoperable with every other. Its approach to CSS is influenced by Object-Oriented CSS principles, functional CSS, an
2 min read
Materialize CSS Pagination
Pagination is used to separate the content into discrete pages that is short and easy to understand. Materialize CSS provide classes to create a pagination bar that holds the links to the other pages. The pagination class is used to set the <ul> list element as a pagination component. The pages that have to be shown are defined inside this co
2 min read
How to we create Pagination in Materialize CSS ?
Materialize CSS is a front-end UI library that is created by Google using the combination of HTML, CSS, and JavaScript. It is basically a design language that combines classic design along with modern innovations and technology. The purpose of Google behind developing Materialize CSS is to provide a unified system design for all their products acro
3 min read
Foundation CSS Kitchen Sink Pagination
Foundation CSS is the frontend framework of CSS that is used to build responsive websites, apps, and emails that work perfectly on any device. It is written using HTML, CSS, and Javascript and is used by many famous companies like Amazon, Facebook, eBay, etc. It uses packages like Grunt and Libsass for fast coding and controlling and Saas compiler
2 min read
Foundation CSS Pagination Basics
Foundation CSS is an open-source & responsive front-end framework built by ZURB foundation in September 2011, that makes it easy to design beautiful responsive websites, apps, and emails that look amazing & can be accessible to any device. It is used by many companies such as Facebook, eBay, Mozilla, Adobe, and even Disney. The framework is
2 min read
Foundation CSS Pagination Centered
Foundation CSS is an open-source & responsive front-end framework built by ZURB foundation in September 2011, that makes it easy to design beautiful responsive websites, apps, and emails that look amazing & can be accessible to any device. It is used by many companies such as Facebook, eBay, Mozilla, Adobe, and even Disney. The framework is
2 min read
Foundation CSS Pagination
Foundation CSS is the frontend framework of CSS that is used to build responsive websites, apps, and emails that work perfectly on any device. It is written using HTML, CSS, and Javascript and is used by many famous companies like Amazon, Facebook, eBay, etc. It uses packages like Grunt and Libsass for fast coding and controlling and Saas compiler
3 min read
Primer CSS Numbered Pagination
Primer CSS is open-source on Github that is created with GitHub’s design system. We can use Primer CSS by installing it via npm or include the CDN link in our HTML file. It has different types of styles like spacing, color, and typography. Primer CSS Pagination is used to jump to any related page using the link. Primer CSS Numbered Pagination is us
2 min read
Primer CSS Pagination
Primer CSS is a free open-source CSS framework that is built upon systems that create the foundation of the basic style elements such as spacing, typography, and color. This systematic method makes sure our patterns are steady and interoperable with every other. Its approach to CSS is influenced by Object-Oriented CSS principles, functional CSS, an
2 min read
Foundation CSS Pagination Sass Reference
Foundation CSS is an open-source and responsive front-end framework built by ZURB foundation in September 2011, that makes it easy to design beautiful responsive websites, apps, and emails that look amazing and can be accessible to any device. It is used by many companies such as Facebook, eBay, Mozilla, Adobe, and even Disney. The framework is bui
4 min read
Create a Pagination Component using HTML CSS and JavaScript
In this article, we are going to create a pagination component using HTML, CSS, and JavaScript. Websites may need multiple pages to display the items for easier navigation and better user experiences. If you are looking to display large amounts of data on your site, like a blog, charts, or graphs that show information about the same data set, you w
3 min read
How to make a Pagination using HTML and CSS ?
Creating pagination is quite simple, you can easily do that by using Bootstrap, and JavaScript. However, in this article, we will use HTML and CSS to create pagination.  Pagination is helpful when the website contains lots of content on a single page, and a single page will not look good with all those topics together. Few websites use the scroll t
3 min read
How to Change the Size of the Pagination using CSS ?
Pagination is an important user interface component that enables navigation through a set of pages. We can customize this element by adjusting its size. These are the two different approaches to customize and change the pagination size using CSS: Table of Content Using font-size PropertyUsing ScalingUsing font-size PropertyIn this approach, we are
3 min read
How to Add Borders to Pagination in CSS ?
Add borders to Pagination is when you have many pages of content and must move between them. Making these page buttons look better can make navigating easier and more enjoyable for users. One way to do this is by adding borders to the page buttons using CSS. These are the following approaches: Table of ContentUsing Border PropertyUsing Border-Style
3 min read
How to Add Hoverable Pagination using CSS ?
Pagination is a common technique for controlling content that covers multiple pages. Hoverable pagination provides a sleek alternative to traditional pagination styles by enabling users to preview the content without clicking by hovering over the pagination elements. Traditional pagination styles require users to click through numbered links to nav
2 min read
How to Create a Transition Effect on Hover Pagination using CSS ?
In web development, pagination is a common feature used to navigate through a large set of data or content. Adding a transition effect on hover to pagination buttons can enhance user interaction and provide visual feedback. ApproachIn this approach, we are going to use CSS transitions. It enables smooth changes in CSS property values over a specifi
1 min read
Create a Pagination using HTML CSS and JavaScript
In this article, we will create a working pagination using HTML, CSS, and JavaScript. Pagination, a widely employed user interface­ pattern, serves the purpose of dividing extensive­ data or content into more manageable­ portions. It allows users the ability to effortle­ssly navigate through numerous content pages, facilitating their search for spe
5 min read
Create Pagination UI Using React And Tailwind CSS
When working with huge data sets in online applications, pagination is an essential feature. It makes a lengthy list of items easier to browse through by dividing them into digestible parts. This article will tell you how to use Tailwind CSS for styling and React for front-end functionality to create a pagination user interface. Prerequisites React
3 min read
Bootstrap Alerts , Wells, Pagination and Pager
Introduction and InstallationGrid SystemButtons, Glyphicons, TablesVertical Forms, Horizontal Forms, Inline FormsDropDowns and Responsive TabsProgress Bar and Jumbotron Alerts: We often see certain alerts on some websites before or after completing an action. These alert messages are highlighted texts that are important to take into consideration w
4 min read
React Suite <Pagination> Props
A React suite is a library of React components, sensible UI design, and a friendly development experience. It is supported in all major browsers. It provides pre-built components of React which can be used easily in any web application. In this article, we'll learn about React suite Prop <Pagination>. <Pagination> component is used to a
3 min read
PHP Pagination | Set 1
PHP is mostly used to store and show data from a database according to the user's requirements. For example, let us think that we have organized a competition and now have the challenge to show the leaderboard. Our event was very successful and had a participation of over Ten Thousand. Now if we have to show the whole list on one page, the page wil
5 min read
PHP Pagination | Set 2
In the previous article on PHP Pagination, we had seen why pagination is needed and also developed a basic structure for implementing a pagination system using PHP. In continuation, let us start with our development process and first create a script to connect to our Database. Connecting to Database Connecting to Database is often a required task f
7 min read
PHP Pagination | Set 3
In the previous article PHP Pagination | Set 2, we developed a simple pagination system that was logically correct but it was not visually appealing because of all the page numbers stacked and occupied a lot of screen space. Then what is the remedy? It is simple when a user is looking up a particular page number it can be assumed that he will be mo
6 min read
Bootstrap 4 | Pagination
Pagination is used to enable navigation between pages in a website. The pagination used in Bootstrap has a large block of connected links that are hard to miss and are easily scalable. Basic Pagination: The basic pagination can be specified using the following classes. The .pagination class is used to specify pagination on a list group.The .page-it
5 min read
React Suite Pagination Advanced
React Suite is a front-end library designed for the middle platform and back-end products. React Suite Pagination component allows the user to select a specific page from various pages. The component also allows us to customize the component, for doing it we use the layout prop. The layout prop accepts an array. The values in the array can be 'tota
3 min read
Bulma | Pagination
Bulma is a FLexbox based open-source CSS framework and its completely free. It is component rich, compatible, and well documented. It is highly responsive in nature. It uses classes to implement its design. The 'pagination' is a component used to indicate the existence of a series of related content across multiple pages. Pagination is used to enab
6 min read
React Suite Pagination Component
React Suite is a popular front-end library with a set of React components that are designed for the middle platform and back-end products. Pagination component allows the user to select a specific page from a range of pages. We can use the following approach in ReactJS to use the React Suite Pagination Component. Pagination Props: activePage: It is
3 min read
How to make table searchable and sortable with pagination using jQuery?
The jQuery fancyTable plugin helps the developers to design HTML tables that are searchable and sortable with pagination feature. This plugin is totally based on JavaScript and HTML. Official website for plugin: Please take care of file paths while implementing the codes. https://github.com/myspace-nu/jquery.fancyTable Example 1: The following code
3 min read
EasyUI jQuery pagination widget
In this article, we will learn how to design a pagination widget using jQuery EasyUI. The pagination widget allows the user to navigate data by pages. It helps in building features for interactive web and mobile applications saving a lot of time for developers. Downloads for EasyUI for jQuery: https://www.jeasyui.com/download/index.phpSyntax: var a
2 min read
How to integrate jQuery Pagination Plugin ?
simplePagination.js is a jQuery plugin that provides simple yet fully customizable pagination in our websites. It is a robust and highly customizable jQuery-based pagination system for your long content to improve webpage readability. Its major features are listed below. You can paginate any group of HTML elements on the webpage.It is easy to use a
5 min read
three90RightbarBannerImg