CSS pagination
CSS Pagination Example
In this chapter we will introduce how to create a paging example by using CSS.
Simple paging
If your website has many pages, you need to use paging to navigate each page.
The following example demonstrates how to use HTML and CSS to create pagination:
php中文网(php.cn) 简单的分页
Run and try it
##Click and mouseover pagination Style
If you click on the current page, you can use .active to set the current page style. When hovering the mouse, you can use the :hover selector to modify the style:Run try Justphp中文网(php.cn) 点击及鼠标悬停分页样式
移动鼠标的分页的数字上。
Rounded corner style
Okay Use the border-radius attribute to add a rounded corner style to the selected page number:Run and try itphp中文网(php.cn) 圆角样式
Mouseover transition effect
We can add a transition effect when the mouse moves to the page number by adding the transition attributeRun it and try itphp中文网(php.cn) 鼠标悬停过渡效果
鼠标移动到分页码上。
Bordered paging
We can use the border attribute to add bordered paging:Run and try itphp中文网(php.cn) 带边框分页
Rounded border
##Tips: Link in the first page And add rounded corners to the last pagination link:
Run and try itphp中文网(php.cn) 圆角边框
Page interval
Tips: You can use the margin attribute to add spaces directly to each page number:
Run and try itphp中文网(php.cn) 分页间隔
Pagination font size
We can use the font-size attribute to set the pagination font size:Run it and try itphp中文网(php.cn) 分页字体大小
我们可以使用 font-size 属性来设置分页的字体大小:
Centered paging
If you want the paging to be centered, you can add the text-align:center style on the container element (such as