8.18. CSS paging instance

发布时间 : 2025-10-25 13:34:14 UTC      

Page Views: 9 views

In this section we will show you how to create paging instances by using CSS.

8.18.1. Simple paging

If your site has many pages, you need to use paging to navigate each page.

The following example demonstrates how to use HTML and CSS to create pages:

CSS instance

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; } 

8.18.2. Click and mouse over paging style

  • «

  • 1

  • 2

  • 3

  • 4

  • 5

  • 6

  • 7

  • »

If you click the current page, you can use the .active to set the current page style, you can use the :hover selector to modify the style:

CSS instance

ul.pagination li a.active{ background-color:#4CAF50; color:white; } ul.pagination li a:hover:not(.active){background-color:#ddd;} 

CSS instance

ul.pagination li a.active { background-color: #4CAF50; color: white; } ul.pagination li a:hover:not(.active) {background-color: #ddd;} 

Fillet styl

  • «

  • 1

  • 2

  • 3

  • 4

  • 5

  • 6

  • 7

  • »

Can be used border-radius property to add a fillet style for the selected page number:

CSS instance

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

Mouse hover transition effect

  • «

  • 1

  • 2

  • 3

  • 4

  • 5

  • 6

  • 7

  • »

We can add transition property to add a transition effect when the mouse moves over the page number

CSS instance

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

8.18.3. Paging with a border

  • «

  • 1

  • 2

  • 3

  • 4

  • 5

  • 6

  • 7

  • »

We can use it. border property to add paging with borders:

CSS instance

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

Fillet border

Tip: add fillets to the first and last paging links:

  • «

  • 1

  • 2

  • 3

  • 4

  • 5

  • 6

  • 7

  • »

CSS instance

.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; } 

Paging interval

Tip: you can use the margin property to add spaces directly to each page number:

  • «

  • 1

  • 2

  • 3

  • 4

  • 5

  • 6

  • 7

  • »

CSS instance

ul.pagination li a { margin: 0 4px; /\* 0 Corresponding to the head and bottom, you can modify it to see the effect \*/ } 

8.18.4. Paging font size

  • «

  • 1

  • 2

  • 3

  • 4

  • 5

  • 6

  • 7

  • »

We can use it. font-size property to set the font size for paging

CSS instance

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

8.18.5. Center paging

  • «

  • 1

  • 2

  • 3

  • 4

  • 5

  • 6

  • 7

  • »

If you want to center the page, you can add it on the container element (such as < div >) text-align:center style:

CSS instance

div.center { text-align: center; } 

8.18.6. More Instanc

CSS instance

8.18.7. Bread crumb navigation

  • Home page

  • Front end

  • HTML tutorial

  • HTML paragraph

Another kind of navigation is bread crumb navigation. An example is as follows:

CSS instance

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"; } 
《地理信息系统原理、技术与方法》  97

最近几年来,地理信息系统无论是在理论上还是应用上都处在一个飞速发展的阶段。 GIS被应用于多个领域的建模和决策支持,如城市管理、区划、环境整治等等,地理信息成为信息时代重要的组成部分之一; “数字地球”概念的提出,更进一步推动了作为其技术支撑的GIS的发展。 与此同时,一些学者致力于相关的理论研究,如空间感知、空间数据误差、空间关系的形式化等等。 这恰好说明了地理信息系统作为应用技术和学科的两个方面,并且这两个方面构成了相互促进的发展过程。