Pagenation full với border

Trở về

  • 2,632

Pagenation full width và border, thêm dạng cho layout cân đối.

Đánh số trang (Pagination) – linh hoạt phần 2

Sử dụng position điều khiển "Previous" và "Next" để tạo định dạng với chiều rộng 100%.

Html viết:

<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>Học Web Chuẩn</title>
<style>
* { /* reset lại margin và padding cho các tag */
    margin: 0;
    padding: 0;
}
.pagination {
    position: relative;
    text-align: center;
    width: 100%; /* cần cho IE6 */
}
.pagination p,
.pagination ol,
.pagination ol li {
    display:inline;
}
.pagination ol {
    margin: 0 10px;
}
* html .pagination ol { /* hack IE6 */
    margin: 0 10px 0 14px;
}
*:first-child + html .pagination ol { /* hack IE7 */
    margin: 0 10px 0 14px;
}
.pagination a,
.pagination ol li span {
    border: 1px solid #333;
    color: #333;
    display: inline-block;
    padding: 1px 8px 2px;
    text-decoration: none;
}
.pagination a:hover {
    color: #f00;
}
.pagination ol li span {
    color: #f00;
    font-weight: bold;
}
.pagination p {
    position: absolute;
    top: 0;
}
.pagination p.previous {
    left: 0;
}
.pagination p.next {
    right: 0;
}
</style>
</head>
<body>
<div class="pagination">
<p class="previous"><a href="http://hocwebchuan.com/">&lt;&lt; Previous</a></p>
<ol>
<li><a href="http://hocwebchuan.com/">1</a></li>
<li><span>2</span></li>
<li><a href="http://hocwebchuan.com/">3</a></li>
<li><a href="http://hocwebchuan.com/">4</a></li>
<li><a href="http://hocwebchuan.com/">5</a></li>
</ol>
<p class="next"><a href="http://hocwebchuan.com/">Next &gt;&gt;</a></p>
</div>
</body>
</html>

Hiển thị trình duyệt:

 

Download file để thực hành

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.