loading

CSS Pagination


Discover how to use CSS to design a pagination that is responsive.


Simple Pagination

If your website has a lot of pages, you might want to add pagination to each one of them:

Css Pagination -

Example

				
					.pagination {
  display: inline-block;
}

.pagination a {
  color: black;
  float: left;
  padding: 8px 16px;
  text-decoration: none;
}
				
			

Active and Hoverable Pagination

Css Pagination -

With a .active class to highlight the current page, you can use the hover selector to alter the color of each page link as you move the mouse over it:

Example

				
					.pagination a.active {
  background-color: #4CAF50;
  color: white;
}

.pagination a:hover:not(.active) {background-color: #ddd;}
				
			

Rounded Active and Hoverable Buttons

Css Pagination -

Add the border-radius property if you want a rounded “active” and “hover” button:

Example

				
					.pagination a {
  border-radius: 5px;
}

.pagination a.active {
  border-radius: 5px;
}
				
			

Hoverable Transition Effect

Css Pagination -

To add a transition effect when the page links are hovered over, add the transition attribute to them:

Example

				
					.pagination a {
  transition: background-color .3s;
}
				
			

Bordered Pagination

Css Pagination -

To add borders to the pagination, use the border property:

Example

				
					.pagination a {
  border: 1px solid #ddd; /* Gray */
}
				
			

Rounded Borders

Css Pagination -

Advice: Give your first and last links in the pagination rounded borders.

Example

				
					.pagination a:first-child {
  border-top-left-radius: 5px;
  border-bottom-left-radius: 5px;
}

.pagination a:last-child {
  border-top-right-radius: 5px;
  border-bottom-right-radius: 5px;
}
				
			

Space Between Links

Advice: If you would prefer not to group the page links, add the margin property:

Css Pagination -

Example

				
					.pagination a {
  margin: 0 4px; /* 0 is for top and bottom. Feel free to change it */
}
				
			

Pagination Size

Css Pagination -

Use the font-size attribute to alter the pagination’s size:

Example

				
					.pagination a {
  font-size: 22px;
}
				
			

Centered Pagination

Css Pagination -

Use text-align:center to encircle a container element (such as <div>) to center the pagination.

Example

				
					.center {
  text-align: center;
}
				
			

More Examples

Example

Css Pagination -

Breadcrumbs

----Example mukava----

Another variation of pagination is so-called “breadcrumbs”:

Example

				
					ul.breadcrumb {
  padding: 8px 16px;
  list-style: none;
  background-color: #eee;
}

ul.breadcrumb li {display: inline;}

ul.breadcrumb li+li:before {
  padding: 8px;
  color: black;
  content: "/\00a0";
}
				
			
Share this Doc

CSS Pagination

Or copy link

Explore Topic