分页用于将内容分成简短且易于理解的离散页面。 Materialize CSS提供了一些类来创建一个分页栏, 该分页栏包含指向其他页面的链接。
的分页class用于将<
ul>
列表元素设置为分页组件。必须显示的页面在此组件内定义为<
li>
项。左右箭头图标可用于显示用于移至下一页或上一页的按钮。
语法如下:
<
ul class="pagination">
<
li class="disabled">
<
a href="https://www.lsbin.com/#!">
<
i class="material-icons">
chevron_left<
/i>
<
/a>
<
/li>
<
li class="active">
<
a href="https://www.lsbin.com/#!">
1<
/a>
<
/li>
<
li class="waves-effect">
<
a href="https://www.lsbin.com/#!">
2<
/a>
<
/li>
<
li class="waves-effect">
<
a href="https://www.lsbin.com/#!">
3<
/a>
<
/li>
<
li class="waves-effect">
<
a href="https://www.lsbin.com/#!">
<
i class="material-icons">
chevron_right<
/i>
<
/a>
<
/li>
<
/ul>
例子:
的HTML
<
html >
<
head >
<
meta name = "viewport" content =
"width=device-width, initial-scale=1.0" />
<
!-- Import Material Icon Fonts -->
<
link rel = "stylesheet" href =
"https://fonts.googleapis.com/icon?family=Material+Icons" >
<
!-- Include Compiled and minified
Materialize CSS -->
<
link rel = "stylesheet" href =
"https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.5/css/materialize.min.css" >
<
!-- Include jQuery -->
<
script type = "text/javascript" src =
"https://code.jquery.com/jquery-2.1.1.min.js" >
<
/ script >
<
!-- Compiled and minified
Materialize JavaScript -->
<
script src =
"https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.5/js/materialize.min.js" >
<
/ script >
<
/ head >
<
body >
<
div class = "card-panel" >
<
h3 class = "center" >
Pagination
<
/ h3 >
<
!-- Use the pagination class -->
<
ul class = "pagination center-align" >
<
!-- Use icon inside list item
for the left arrow -->
<
li class = "disabled" >
<
a href = "https://www.lsbin.com/#!" >
<
i class = "material-icons" >
chevron_left
<
/ i >
<
/ a >
<
/ li >
<
!-- Various classes that can be
used with the page links -->
<
li class = "waves-effect" >
<
a href = "https://www.lsbin.com/#!" >
1<
/ a >
<
/ li >
<
li class = "active green" >
<
a href = "https://www.lsbin.com/#!" >
2<
/ a >
<
/ li >
<
li class = "waves-effect" >
<
a href = "https://www.lsbin.com/#!" >
3<
/ a >
<
/ li >
<
li class = "waves-effect" >
<
a href = "https://www.lsbin.com/#!" >
4<
/ a >
<
/ li >
<
li class = "waves-effect" >
<
a href = "https://www.lsbin.com/#!" >
5<
/ a >
<
/ li >
<
!-- Use icon inside list item
for the right arrow -->
<
li class = "waves-effect" >
<
a href = "https://www.lsbin.com/#!" >
<
i class = "material-icons" >
chevron_right
<
/ i >
<
/ a >
<
/ li >
<
/ ul >
<
/ div >
<
/ body >
<
/ html >
【CSS实现分页详细实现代码】输出如下:
文章图片
推荐阅读
- 如何在href属性内插入JavaScript变量()
- 数字逻辑中的加法器和减法器
- 前端进阶开发实战教程,使用Bootstrap实现博客平台网站响应式布局详解(一)
- Flexbox与Grid布局大比拼,使用哪种布局更好(为什么?)
- 关于使用CSS Grid网格布局,9个严重的错误
- 为什么在JavaScript中不推荐使用for…in()
- 如何在JavaScript的回调中正确地访问“this”()
- JavaScript中如何验证邮箱地址()
- javascript如何更简单地在指定索引位置插入一个字符串()