Responsive Pagination

Size
3,503 Kb
Views
20,240

How do I make an responsive pagination?

What is a responsive pagination? How do you make a responsive pagination? This script and codes were developed by Torben Colding on 17 October 2022, Monday.

Responsive Pagination Previews

Responsive Pagination - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Responsive Pagination</title> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/meyer-reset/2.0/reset.min.css"> <style> /* NOTE: The styles were added inline because Prefixfree needs access to your styles and they must be inlined if they are on local disk! */ * { transition: all .5s;
}
html { font-size: 62.5%;
}
body { display: flex; flex-direction: column; justify-content: center; align-items: center; min-height: 100vh;
}
h1 { font-size: 5rem; font-weight: bold; margin: 4rem 0; text-align: center;
}
.pagination,
.pagination ul { display: flex;
}
.pagination { justify-content: center;
}
.pagination li { background: #ddd; margin: .5rem; border-radius: 1rem; position: relative;
}
.pagination a { text-decoration: none; color: inherit; display: block; padding: 1rem 2rem; font-size: 3rem;
}
@media only screen and (max-width: 960px) { .pagination li:nth-child(2) { margin-right: 6rem; } .pagination li:nth-child(2) ~ li { display: none; } .pagination li:nth-last-child(3) ~ li { display: block; } .pagination li:nth-child(2):after { position: absolute; content: "..."; font-size: 3rem; top: 0; left: 7.5rem; }
}
@media only screen and (max-width: 720px) { html { font-size: 50%; } .previous a, .next a { text-indent: -5000px; overflow: hidden; background-position: center center; background-repeat: no-repeat; background-size: 100%; } .previous a { transform: rotate(180deg); background-image: url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/15891/ic_navigate_next_black_24px.svg); } .next a { background-image: url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/15891/ic_navigate_next_black_24px.svg); }
}
@media only screen and (max-width: 480px) { .pagination .pages { display: none; }
} </style> <script src="https://cdnjs.cloudflare.com/ajax/libs/prefixfree/1.0.7/prefixfree.min.js"></script>
</head>
<body> <h1>Responsive Pagination</h1>
<nav class="pagination"> <ul class="previous"> <li><a href="">Previous</a></li> </ul> <ul class="pages"> <li><a href="">1</a></li> <li><a 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="">8</a></li> <li><a href="">9</a></li> <li><a href="">10</a></li> </ul> <ul class="next"> <li><a href="">Next</a></li> </ul>
</nav>
</body>
</html>

Responsive Pagination - Script Codes CSS Codes

* { transition: all .5s;
}
html { font-size: 62.5%;
}
body { display: flex; flex-direction: column; justify-content: center; align-items: center; min-height: 100vh;
}
h1 { font-size: 5rem; font-weight: bold; margin: 4rem 0; text-align: center;
}
.pagination,
.pagination ul { display: flex;
}
.pagination { justify-content: center;
}
.pagination li { background: #ddd; margin: .5rem; border-radius: 1rem; position: relative;
}
.pagination a { text-decoration: none; color: inherit; display: block; padding: 1rem 2rem; font-size: 3rem;
}
@media only screen and (max-width: 960px) { .pagination li:nth-child(2) { margin-right: 6rem; } .pagination li:nth-child(2) ~ li { display: none; } .pagination li:nth-last-child(3) ~ li { display: block; } .pagination li:nth-child(2):after { position: absolute; content: "..."; font-size: 3rem; top: 0; left: 7.5rem; }
}
@media only screen and (max-width: 720px) { html { font-size: 50%; } .previous a, .next a { text-indent: -5000px; overflow: hidden; background-position: center center; background-repeat: no-repeat; background-size: 100%; } .previous a { transform: rotate(180deg); background-image: url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/15891/ic_navigate_next_black_24px.svg); } .next a { background-image: url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/15891/ic_navigate_next_black_24px.svg); }
}
@media only screen and (max-width: 480px) { .pagination .pages { display: none; }
}
Responsive Pagination - Script Codes
Responsive Pagination - Script Codes
Home Page Home
Developer Torben Colding
Username torbencolding
Uploaded October 17, 2022
Rating 3
Size 3,503 Kb
Views 20,240
Do you need developer help for Responsive Pagination?

Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!

Torben Colding (torbencolding) Script Codes
Create amazing blog posts with AI!

Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!