Set width: full 320 768 1024 1920 custom
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Pagination Component</title>
<style>
body {
font-family: Arial, sans-serif;
padding: 20px;
}
.pagination {
display: flex;
align-items: center;
justify-content: center;
gap: 0.5rem;
flex-wrap: wrap;
}
.pagination a, .pagination span {
padding: 8px 12px;
border: 1px solid #ccc;
border-radius: 4px;
text-decoration: none;
color: #333;
transition: background-color 0.3s ease;
}
.pagination a:hover {
background-color: #f0f0f0;
}
.pagination .current {
position: relative;
}
.pagination .current label {
border: 1px solid #007bff;
background-color: #007bff;
color: white;
padding: 8px 12px;
border-radius: 4px;
text-decoration: none;
text-decoration: underline;
text-underline-offset: 3px;
cursor: pointer;
}
.pagination .current:hover label {
background: #006bef;
}
.pagination .current>input {
display: none;
}
.pagination .options {
display: none;
position: absolute;
top: calc(100% + 14px);
left: 50%;
transform: translateX(-50%);
background: #fff;
padding: 1em;
border: 1px solid #ccc;
border-radius: 4px;
user-select: none;
font-size: .85em;
white-space: nowrap;
}
.pagination .current input:checked + .options {
display: block;
}
.pagination .options::before {
content: "";
position: absolute;
top: -11px;
left: 50%;
transform: translateX(-50%);
border-left: 10px solid transparent;
border-right: 10px solid transparent;
border-bottom: 10px solid #ccc;
}
.pagination .options::after {
content: "";
position: absolute;
top: -10px;
left: 50%;
transform: translateX(-50%);
border-left: 10px solid transparent;
border-right: 10px solid transparent;
border-bottom: 10px solid #fff;
}
.pagination .options input, .pagination .options button {
padding: 4px 8px;
border-radius: 4px;
}
.pagination .options button {
border: 1px solid #108bff;
background: #108bff;
color: #fff;
margin-left: .25em;
cursor: pointer;
}
.pagination .options button:hover {
background: #006bef;
}
.pagination .options p {
margin: 0 0 8px 0;
display: flex;
}
.pagination .options p:last-child {
margin-bottom: 0;
}
.pagination .disabled {
color: #aaa;
pointer-events: none;
}
.pagination input {
width: 50px;
padding: 8px;
border: 1px solid #ccc;
border-radius: 4px;
text-align: center;
}
.info {
text-align: center;
color: #777;
font-size: .85em;
margin-top: 1.5em;
}
@media (max-width: 600px) {
.pagination {
gap: 0.25rem;
}
.pagination a, .pagination span {
padding: 6px 8px;
font-size: 0.9rem;
}
.pagination a.hide-on-mobile,
.pagination span.hide-on-mobile {
display: none;
}
.pagination input {
width: 40px;
padding: 6px;
font-size: 0.9rem;
}
}
</style>
</head>
<body>
<nav class="pagination">
<a href="#">‹</a>
<a href="#" class="hide-on-mobile">45</a>
<a href="#" class="hide-on-mobile">46</a>
<a href="#">47</a>
<div class="current">
<label for="current-page">48</label>
<input type="checkbox" id="current-page" />
<div class="options">
<p>Go to page:</p>
<p>
<input type="number" value="48" />
<button type="button">Go</button>
</p>
</div>
</div>
<a href="#">49</a>
<a href="#" class="hide-on-mobile">50</a>
<a href="#" class="hide-on-mobile">51</a>
<a href="#">›</a>
</nav>
<p class="info">
(click the current page button)
</p>
</body>
</html>