当前位置:网站首页>An article takes you to understand CSS pagination examples
An article takes you to understand CSS pagination examples
2020-11-06 20:42:00 【Python advanced】
The effect of paging in life is everywhere , Today, we will give you a detailed analysis of the paging effect .
How to use HTML and CSS To create pages ?
If your website has many pages , You need to use paging to navigate each page
One 、 Paging type
1. Simple Paging
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title> project </title>
<style>
ul.pagination {
display: inline-block;
padding: 0;
margin: 0;
}
ul.pagination li {
display: inline;
}
ul.pagination li a {
color: black;
float: left;
padding: 8px 16px;
text-decoration: none;
}
</style>
</head>
<body>
<h2>Simple Pagination</h2>
<ul class="pagination">
<li><a href="#">«</a></li>
<li><a href="#">1</a></li>
<li><a class="active" href="#">2</a></li>
<li><a href="#">3</a></li>
<li><a href="#">4</a></li>
<li><a href="#">5</a></li>
<li><a href="#">6</a></li>
<li><a href="#">7</a></li>
<li><a href="#">»</a></li>
</ul>
</body>
</html>
Click and mouse hover page style
If you click the current page , have access to .active To set the current page style , Hover over to use :hover Selector to modify style :
CSS example
ul.pagination li a.active {
background-color: #4CAF50;
color: white;
}
ul.pagination li a:hover:not(.active) {background-color: #ddd;}
2. Page style
2.1 Fillet style paging
have access to border-radius Property to add fillet style for the selected page number :
CSS example
ul.pagination li a {
border-radius: 5px;
}
ul.pagination li a.active {
border-radius: 5px;
}
Mouse hover transition effect
We can add transition Property to add a transition effect to the mouse as it moves over the page number :
CSS example
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title> project </title>
<style>
ul.pagination {
display: inline-block;
padding: 0;
margin: 0;
}
ul.pagination li {display: inline;}
ul.pagination li a {
color: black;
float: left;
padding: 8px 16px;
text-decoration: none;
transition: background-color .3s;
border: 1px solid #ddd;
}
.pagination li:first-child a {
border-top-left-radius: 5px;
border-bottom-left-radius: 5px;
}
.pagination li:last-child a {
border-top-right-radius: 5px;
border-bottom-right-radius: 5px;
}
ul.pagination li a.active {
background-color: #f00;
color: white;
border: 1px solid #f00;
}
ul.pagination li a:hover:not(.active) {background-color: #ddd;}
</style>
</head>
<body>
<h2>Pagination with Rounded Borders</h2>
<ul class="pagination">
<li><a href="#">«</a></li>
<li><a href="#">1</a></li>
<li><a class="active" href="#">2</a></li>
<li><a href="#">3</a></li>
<li><a href="#">4</a></li>
<li><a href="#">5</a></li>
<li><a href="#">6</a></li>
<li><a href="#">7</a></li>
<li><a href="#">»</a></li>
</ul>
</body>
</html>
2.2 Page with borders
We can use border Property to add border paging :
CSS example
ul.pagination li a {
border: 1px solid #ddd; /* Gray */
}
2.3. Paging interval
Tips : You can use margin Property to add spaces directly to each page number :
CSS example
ul.pagination li a {
margin: 0 4px; /* 0 is for top and bottom. Feel free to change it */
}
2.4 Page font size
We can use font-size Property to set the font size of the page :
CSS example
ul.pagination li a {
font-size: 22px;
}
2.5 Center page
If you want to center the page , Can be on container elements ( Such as <div>
) add to text-align:center
style :
CSS example
div.center {
text-align: center;
}
Two 、 Case study
Breadcrumb navigation
Another navigation is crumb navigation ,
Examples are as follows :
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title> project </title>
<style>
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";
}
ul.breadcrumb li a {color: green;}
</style>
</head>
<body>
<h2>Breadcrumb Pagination</h2>
<ul class="breadcrumb">
<li><a href="#">Home</a></li>
<li><a href="#">Pictures</a></li>
<li><a href="#">Summer 15</a></li>
<li>Italy</li>
</ul>
</body>
</html>
3、 ... and 、 summary
This paper takes the phenomenon in life as the starting point , It mainly introduces Html Page effect in the use of styles , Application of paging effect when mouse hovers .
Use rich cases to help you understand the object better , Finally “ Breadcrumb navigation ” As a small project , Use Html programing language , Make a general integration of the results described above , It is convenient for you to increase the understanding of classes and objects , I hope it will help you in your study .
Want to learn more Python Web crawler and data mining knowledge , Go to a professional website :http://pdcfighting.com/ Want to learn more Python Web crawler and data mining knowledge , Go to a professional website :http://pdcfighting.com/
版权声明
本文为[Python advanced]所创,转载请带上原文链接,感谢
边栏推荐
- Uncle Bob: the software architecture is similar to a house. Object oriented is the structure of the house, and the water pipe is functional programming
- Jetcache buried some of the operation, you can't accept it
- electron 實現檔案下載管理器
- 【:: 是什么语法?】
- 嘉宾专访|2020 PostgreSQL亚洲大会阿里云数据库专场:曾文旌
- Unity性能优化整理
- 意外的元素..所需元素..
- Asp.Net Core learning notes: Introduction
- The AI method put forward by China has more and more influence. Tianda et al. Mined the development law of AI from a large number of literatures
- 一部完整的游戏,需要制作哪些音乐?
猜你喜欢
How to understand Python iterators and generators?
新建一个空文件占用多少磁盘空间?
Even liver three all night, jvm77 high frequency interview questions detailed analysis, this?
华为Mate 40 系列搭载HMS有什么亮点?
Look! Internet, e-commerce offline big data analysis best practice! (Internet disk link attached)
Helping financial technology innovation and development, atfx is at the forefront of the industry
Network security engineer Demo: the original * * is to get your computer administrator rights! [maintain]
What are the criteria for selecting a cluster server?
如何在终端启动Coda 2中隐藏的首选项?
Filecoin has completed a major upgrade and achieved four major project progress!
随机推荐
Building a new generation cloud native data lake with iceberg on kubernetes
WeihanLi.Npoi 1.11.0/1.12.0 Release Notes
How about small and medium-sized enterprises choose shared office?
新建一个空文件占用多少磁盘空间?
Network programming NiO: Bio and NiO
Discussion on the development practice of aspnetcore, a cross platform framework
JVM内存分配 -Xms128m -Xmx512m -XX:PermSize=128m -XX:MaxPermSize=512m
JNI-Thread中start方法的呼叫與run方法的回撥分析
【转发】查看lua中userdata的方法
游戏开发中的新手引导与事件管理系统
美团内部讲座|周烜:华东师范大学的数据库系统研究
It's time for your financial report to change to a more advanced style -- financial analysis cockpit
What is the meaning of sector sealing of filecoin mining machine since the main network of filecoin was put online
A small goal in 2019 to become a blog expert of CSDN
Gather in Beijing! The countdown to openi 2020
C# 调用SendMessage刷新任务栏图标(强制结束时图标未消失)
What if the front end doesn't use spa? - Hacker News
Behind the record breaking Q2 revenue of Alibaba cloud, the cloud opening mode is reshaping
快速排序为什么这么快?
Introduction to the structure of PDF417 bar code system