这是一款有趣的css3折角分页样式代码。该css3折角分页样式代码在鼠标经过时,分页项的左上角会像纸张一样弯曲折角,效果十分好看。
使用方法
HTML结构
该css3折角分页样式的HTML结构如下:
<div class="demo"> <nav class="pagination-outer" aria-label="Page navigation"> <ul class="pagination"> <li class="page-item"> <a href="#" class="page-link" aria-label="Previous"> <span aria-hidden="true">«</span> </a> </li> <li class="page-item"><a class="page-link" href="#">1</a></li> <li class="page-item"><a class="page-link" href="#">2</a></li> <li class="page-item active"><a class="page-link" href="#">3</a></li> <li class="page-item"><a class="page-link" href="#">4</a></li> <li class="page-item"><a class="page-link" href="#">5</a></li> <li class="page-item"> <a href="#" class="page-link" aria-label="Next"> <span aria-hidden="true">»</span> </a> </li> </ul> </nav> </div>
CSS样式
然后通过下面的CSS样式来实现该css3折角分页样式效果。
.pagination-outer{ text-align: center; } .pagination{ display: inline-flex; border-radius: 0; overflow: hidden; position: relative; } .pagination li a.page-link{ width: 45px; height: 45px; line-height: 35px; background: #ff095c; border-radius: 0; border: none; outline: 2px solid #fff; outline-offset: -6px; font-size: 20px; font-weight: 700; color: #fff; letter-spacing: 1px; margin: 0 8px 0 0; position: relative; z-index: 1; transition: all 0.4s ease 0s; } .pagination li:first-child a.page-link, .pagination li:last-child a.page-link{ line-height: 32px; } .pagination li:last-child a.page-link{ margin-right: 0; } .pagination li.active a.page-link, .pagination li a.page-link:hover, .pagination li.active a.page-link:hover{ background: #ff095c; color: #fff; outline: thin dotted; outline-offset: -2px; } .pagination li a.page-link:before{ content: ""; width: 0; height: 0; background: rgba(0, 0, 0, 0) linear-gradient(135deg, #081f3c 45%, #aaa 50%, #ccc 56%, #fff 80%); box-shadow: 1px 1px 1px rgba(0, 0, 0, 0.4); position: absolute; top: 0; left: 0; transition: all 0.3s ease 0s; } .pagination li a.page-link:hover:before, .pagination li.active a.page-link:before{ width: 17px; height: 17px; } @media only screen and (max-width: 480px){ .pagination{ display: block; } .pagination li{ display: inline-block; margin-bottom: 10px; } }