If your website features numerous pages, you might want to consider implementing pagination on each page.
Example
.pagination { display: inline-block; } .pagination a { color: black; float: left; padding: 8px 16px; text-decoration: none; } |
Use an .active class to indicate the current page and employ the :hover selector to adjust the color of each page link when hovering over them.
Example
.pagination a.active {
|
Rounded Active and Hoverable Buttons
Incorporate the border-radius property to achieve rounded edges for both the “active” and “hover” button states.
Example
.pagination a { border-radius: 5px; } .pagination a.active { border-radius: 5px; } |
Include the transition property in the page links to generate a transition effect when hovering over them.
Example
.pagination a { transition: background-color .3s; } |
Example
.pagination a { |
Suggestion: Incorporate rounded borders for the first and last links in your pagination.
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; } |
Suggestion: Utilize the margin property to avoid grouping the page links together.
Example
.pagination a { |
Adjust the size of the pagination using the font-size property.
Example
.pagination a { font-size: 22px; } |
To center the pagination, wrap a container element (such as a <div>) around it and apply text-align:center to the container.
Example
.center { |
Example
Another type of pagination is commonly referred to as “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”; } |