How to create a pagination with CSS?

CSSWeb DevelopmentFront End Technology

Following is the code to create pagination with CSS −


 Live Demo

<!DOCTYPE html>
<html lang="en">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
   box-sizing: border-box;
   margin: 15px;
   display: inline-block;
   background-color: rgb(39, 39, 39);
   overflow: auto;
   height: auto;
.links {
   display: inline-block;
   text-align: center;
   padding: 14px;
   color: rgb(178, 137, 253);
   text-decoration: none;
   font-size: 17px;
.links:hover {
   background-color: rgb(100, 100, 100);
   background-color: rgb(0, 18, 43);
<h1> Page pagination example </h1>
<div class="pagePagination">
<a class="links" href="#">«</a>
<a class="links selected" href="#">1</a>
<a class="links" href="#">2</a>
<a class="links" href="#">3</a>
<a class="links" href="#">4</a>
<a class="links" href="#">5</a>
<a class="links" href="#">»</a>
<h2>Hover on the above numbers to see effect</h2>


The above code will produce the following output −

Updated on 06-Apr-2020 11:31:54