×

Html & Html5

The World's best Software Development Study Portal

CSS Pagination



Suppose in a website we are having too many pages than we can add some sort of pagination over there in each page. And pagination pages will be holding our differnt-different link of our HTML webpage.



Let's take an example of basic pagination



<!DOCTYPE html>

<html>

<head>

<style>

.pagination a {

      float:left;

      text-decoration:none;

      padding:9px 17px;

}

</style>

</head>

<body>

<p> Pagination </p>

<div class="pagination">

<a href="#"> 1 </a>

<a href="#"> 2 </a>

<a href="#"> 3 </a>

</div>

</body>

</html>


Output of the Program



Pagination


So here is what the basic pagination is , where we can link our main page into the form of url.



We can also give styling to these pagination links through our CSS. So let's check it out in the following ways:-



Bordered Pagination


We can add borders to our pagination link by just simply specifying border property.



Let's understand this by the following program :-



<!DOCTYPE html>

<html>

<head>

<style>

.pagination a {

      float:left;

      padding:9px 17px;

      border:2px solid royalblue;

}

</style>

</head>

<body>

<p> Pagination with border </p>

<div class="pagination">

<a href="#"> 1 </a>

<a href="#"> 2 </a>

<a href="#"> 3 </a>

</div>

</body>

</html>


Output of the Program



Pagination with border



So this is how we can add borders to our pagination links.



Space between pagination liks


We can add space to our pagination link by just simply specifying margin property.



Let's understand this by the following program :-



<!DOCTYPE html>

<html>

<head>

<style>

.pagination a {



      float:left;

      padding:9px 17px;

      border:2px solid royalblue;

      margin: 4px 15px;

}

</style>

</head>

<body>

<p> spaces in between pagination links t;

<div class="pagination">

<a href="#"> 1 </a>

<a href="#"> 2 </a>

<a href="#"> 3 </a>

</div>

</body>

</html>


Output of the Program



spaces in between pagination links



So this is how we can add space to our pagination links.



Change size pagination liks


We can also change the size of the pagination link by just simply specifying font-size property.



Let's understand this by the following program :-



<!DOCTYPE html>

<html>

<head>

<style>

.pagination a {

      float:left;

      padding:9px 17px;

      border:2px solid royalblue;

      margin: 4px 15px;

      font-size:22px;

}

</style>

</head>

<body>

<p> change size of pagination links </p>

<div class="pagination">

<a href="#"> 1 </a>

<a href="#"> 2 </a>

<a href="#"> 3 </a>

</div>

</body>

</html>


Output of the Program



change size of pagination links



So this is how we can change the size of pagination links.






CSS 3 training insitute | Best IT Training classes in Gurgaon | Web Designing Training Institute