Responsive card grid
LayoutCards that find their own column count, with useful minimum widths and no layout script.
HTML + CSS · No JavaScript
repeat(auto-fit, minmax(min(100%, 16rem), 1fr)) Navigation · Complete runnable example
Divide an existing list into pages with clear boundaries and an accurate visible range.
This preview runs in an isolated document. Clipboard writes and saved preferences may be blocked, and printing requires the standalone file. A dialog affects only the example. Reset reloads the original example state.
Use this pattern for a modest collection already present in the document. Page controls belong to a named navigation region, while a separate status announces which entries are visible.
The preview, copied text, and downloaded file use this same document.
<!doctype html>
<!--
MIT License
Copyright (c) 2026 MRHTML
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
-->
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta
http-equiv="Content-Security-Policy"
content="default-src 'none'; style-src 'unsafe-inline'; script-src 'unsafe-inline'; img-src data: blob:; connect-src 'none'; form-action 'none'; object-src 'none'; base-uri 'none'"
/>
<title>MRHTML | One page at a time.</title>
<style>
:root {
font-family: Arial, Helvetica, sans-serif;
color-scheme: light;
--ink: #192f34;
--muted: #56666a;
--paper: #f6f5f0;
--line: #cdd5d0;
--accent: #186354;
--soft: #e7efe5;
--mono: Consolas, 'Liberation Mono', monospace;
}
* {
box-sizing: border-box;
}
html {
scroll-padding-top: 90px;
}
body {
margin: 0;
background: var(--paper);
color: var(--ink);
line-height: 1.6;
}
h1,
h2,
h3,
p {
margin: 0;
}
h1,
h2,
h3 {
font-weight: 500;
letter-spacing: -0.045em;
line-height: 1.1;
}
h1 {
font-size: clamp(38px, 5.5vw, 65px);
}
h2 {
font-size: 29px;
}
h3 {
font-size: 21px;
}
p {
overflow-wrap: anywhere;
}
a {
color: var(--accent);
text-underline-offset: 4px;
}
button,
select {
font: inherit;
color: inherit;
}
button {
cursor: pointer;
}
button,
a,
summary {
touch-action: manipulation;
}
button:focus-visible,
a:focus-visible,
select:focus-visible,
[tabindex]:focus-visible,
summary:focus-visible {
outline: 3px solid #a94823;
outline-offset: 4px;
}
[hidden] {
display: none !important;
}
.wrap {
width: min(1050px, calc(100% - 64px));
margin-inline: auto;
}
.header {
display: flex;
justify-content: space-between;
align-items: center;
gap: 20px;
padding: 28px 0;
border-bottom: 1px solid var(--line);
}
.brand {
font-size: 15px;
font-weight: 700;
display: flex;
align-items: center;
gap: 10px;
letter-spacing: -0.5px;
}
.mark {
display: grid;
place-items: center;
width: 28px;
height: 28px;
background: var(--accent);
color: #fff;
font-weight: bold;
font-size: 18px;
}
.header > p,
.eyebrow,
.small {
font: 10px/1.7 var(--mono);
letter-spacing: 0.03em;
}
.header > p {
color: var(--muted);
}
main {
padding-block: 43px 50px;
}
.intro {
margin-bottom: 30px;
max-width: 720px;
}
.eyebrow {
color: var(--accent);
margin-bottom: 13px;
}
.intro > p:last-child {
font-size: 15px;
max-width: 570px;
color: var(--muted);
margin-top: 18px;
}
.surface {
background: #fff;
border: 1px solid var(--line);
border-radius: 14px;
box-shadow: 0 12px 32px #263e3010;
}
.button {
border: 1px solid var(--accent);
background: var(--accent);
color: #fff;
padding: 10px 16px;
min-height: 43px;
border-radius: 7px;
font-size: 13px;
font-weight: 600;
}
.button.secondary {
background: #fff;
color: var(--accent);
border-color: #a9bbb0;
}
.button[aria-disabled='true'],
button:disabled {
background: #edf0e9;
color: #5d695f;
border-color: #c9d1c4;
cursor: default;
}
.status {
font-size: 12px;
color: var(--muted);
min-height: 22px;
}
.note {
font-size: 12px;
color: var(--muted);
margin-top: 20px;
max-width: 75ch;
}
.footer {
display: flex;
justify-content: space-between;
gap: 20px;
padding-block: 22px;
border-top: 1px solid var(--line);
font-size: 10px;
color: var(--muted);
}
.sr-only {
position: absolute;
width: 1px;
height: 1px;
padding: 0;
margin: -1px;
overflow: hidden;
clip: rect(0, 0, 0, 0);
white-space: nowrap;
border: 0;
}
noscript p {
padding: 15px;
background: #e8ece2;
border-left: 3px solid var(--accent);
font-size: 13px;
margin-bottom: 20px;
}
code,
kbd {
font: 12px var(--mono);
}
kbd {
border: 1px solid #bcc7bd;
border-radius: 4px;
padding: 2px 5px;
background: #fff;
}
button:disabled:focus {
outline: none;
}
@media (max-width: 600px) {
.wrap {
width: calc(100% - 36px);
}
.header {
padding-block: 22px;
}
.header > p {
font-size: 8px;
max-width: 105px;
text-align: right;
}
.brand {
font-size: 13px;
gap: 8px;
}
main {
padding-block: 30px 35px;
}
.intro {
margin-bottom: 26px;
}
.intro > p:last-child {
font-size: 14px;
}
.eyebrow {
font-size: 9px;
}
h1 {
font-size: 40px;
}
.footer {
flex-wrap: wrap;
font-size: 9px;
}
}
@media (max-width: 350px) {
h1 {
font-size: 35px;
}
.button {
padding: 10px 12px;
font-size: 12px;
}
}
@media (prefers-reduced-motion: reduce) {
*,
*::before,
*::after {
animation: none !important;
transition: none !important;
scroll-behavior: auto !important;
}
}
.shelf-head {
display: flex;
align-items: center;
justify-content: space-between;
gap: 25px;
border-bottom: 1px solid var(--line);
padding-bottom: 23px;
}
.shelf-head h2 {
font-size: 25px;
}
#page-size-controls {
display: flex;
align-items: center;
gap: 12px;
}
label {
font-size: 12px;
color: var(--muted);
}
select {
padding: 9px 11px;
background: #fff;
border: 1px solid #aabbb0;
border-radius: 7px;
}
.reading-list {
list-style: none;
padding: 0;
margin: 0;
}
.reading-list li {
display: flex;
gap: 26px;
padding: 26px 8px;
border-bottom: 1px solid var(--line);
}
.entry-index {
font: 12px var(--mono);
color: var(--accent);
padding-top: 5px;
min-width: 30px;
}
.reading-list .small {
font-size: 9px;
color: var(--accent);
}
.reading-list h2 {
font-size: 26px;
margin-top: 7px;
}
.reading-list li p:last-child {
font-size: 13px;
color: var(--muted);
margin-top: 10px;
}
.page-foot {
display: flex;
align-items: center;
justify-content: space-between;
gap: 20px;
margin-top: 25px;
}
#pagination {
display: flex;
gap: 7px;
align-items: center;
}
#page-number {
font: 11px var(--mono);
padding: 0 10px;
white-space: nowrap;
}
#pagination .button {
padding-inline: 12px;
font-size: 12px;
}
@media (max-width: 700px) {
.page-foot {
align-items: flex-start;
flex-direction: column;
}
.shelf-head {
align-items: flex-start;
flex-direction: column;
gap: 20px;
}
.reading-list li {
gap: 16px;
padding-block: 23px;
}
.reading-list h2 {
font-size: 24px;
}
#pagination {
width: 100%;
gap: 5px;
justify-content: space-between;
}
#pagination .button {
font-size: 11px;
padding-inline: 10px;
}
#page-number {
font-size: 10px;
padding: 0 4px;
}
}
</style>
</head>
<body>
<header class="header wrap">
<span class="brand"
><span class="mark" aria-hidden="true">m.</span>MRHTML / Workshop</span
>
<p>SMALL PATTERNS.<br />CONSIDERED DETAILS.</p>
</header>
<main class="wrap">
<div class="intro">
<p class="eyebrow">02 / LOCAL PAGINATION</p>
<h1>One page at a time.</h1>
<p>
A small reading shelf, divided into manageable pages. Every entry is
already in this document.
</p>
</div>
<noscript
><p>
All eight entries are shown below. JavaScript adds page-size and page
controls.
</p></noscript
>
<div class="shelf-head">
<h2>The workshop shelf</h2>
<div id="page-size-controls" hidden>
<label for="page-size">Entries per page</label
><select id="page-size">
<option value="3">3</option>
<option value="6">6</option>
<option value="9">9</option>
</select>
</div>
</div>
<ol class="reading-list">
<li>
<span class="entry-index">01</span>
<div>
<p class="small">PRACTICE</p>
<h2>A useful first draft</h2>
<p>Start with enough detail to make the next question visible.</p>
</div>
</li>
<li>
<span class="entry-index">02</span>
<div>
<p class="small">FOCUS</p>
<h2>Room to think</h2>
<p>
Leave some space between collecting ideas and choosing a
direction.
</p>
</div>
</li>
<li>
<span class="entry-index">03</span>
<div>
<p class="small">COLLABORATION</p>
<h2>The handoff note</h2>
<p>Record the decisions a future collaborator will need.</p>
</div>
</li>
<li>
<span class="entry-index">04</span>
<div>
<p class="small">SCOPE</p>
<h2>A smaller promise</h2>
<p>Define one complete behavior before adding another.</p>
</div>
</li>
<li>
<span class="entry-index">05</span>
<div>
<p class="small">INTERFACES</p>
<h2>The awkward state</h2>
<p>Make empty, loading, and failed states part of the design.</p>
</div>
</li>
<li>
<span class="entry-index">06</span>
<div>
<p class="small">REFLECTION</p>
<h2>Time to step back</h2>
<p>Revisit the original question before polishing the answer.</p>
</div>
</li>
<li>
<span class="entry-index">07</span>
<div>
<p class="small">CODE</p>
<h2>Make it readable</h2>
<p>Choose names that describe the role of a piece of work.</p>
</div>
</li>
<li>
<span class="entry-index">08</span>
<div>
<p class="small">RESEARCH</p>
<h2>One more question</h2>
<p>Look for the assumption that has not been tested yet.</p>
</div>
</li>
</ol>
<div class="page-foot">
<p
id="page-status"
class="status"
role="status"
aria-live="polite"
aria-atomic="true"
>
Showing all 8 entries.
</p>
<nav id="pagination" aria-label="Reading list pages" hidden>
<button
class="button secondary"
type="button"
data-page="first"
aria-label="First page"
>
«</button
><button class="button secondary" type="button" data-page="previous">
Previous</button
><span id="page-number">1 / 3</span
><button class="button secondary" type="button" data-page="next">
Next</button
><button
class="button secondary"
type="button"
data-page="last"
aria-label="Last page"
>
»
</button>
</nav>
</div>
<p class="note">
Changing the page size starts at page 1. There is no server request, URL
update, or stored reading history.
</p>
</main>
<footer class="footer wrap">
<span>MRHTML / Original runnable example</span
><span>Local content. No network required.</span>
</footer>
<script>
(() => {
'use strict';
const entries = [...document.querySelectorAll('.reading-list>li')];
const size = document.querySelector('#page-size');
const nav = document.querySelector('#pagination');
let page = 0,
limit = 3;
function render() {
const pages = Math.max(1, Math.ceil(entries.length / limit));
page = Math.max(0, Math.min(page, pages - 1));
const start = page * limit,
end = Math.min(start + limit, entries.length);
entries.forEach((entry, index) => {
entry.hidden = index < start || index >= end;
});
document.querySelector('#page-status').textContent = entries.length
? `Showing ${start + 1}–${end} of ${entries.length} entries. Page ${page + 1} of ${pages}.`
: 'No entries to show.';
document.querySelector('#page-number').textContent =
`${page + 1} / ${pages}`;
nav.querySelectorAll('button').forEach((button) => {
const backward = ['first', 'previous'].includes(
button.dataset.page,
);
button.setAttribute(
'aria-disabled',
String(backward ? page === 0 : page === pages - 1),
);
});
}
nav.querySelectorAll('button').forEach((button) =>
button.addEventListener('click', () => {
if (button.getAttribute('aria-disabled') === 'true') return;
const last = Math.max(0, Math.ceil(entries.length / limit) - 1);
page =
button.dataset.page === 'first'
? 0
: button.dataset.page === 'last'
? last
: page + (button.dataset.page === 'next' ? 1 : -1);
render();
}),
);
size.addEventListener('change', () => {
const next = Number(size.value);
if (![3, 6, 9].includes(next)) {
size.value = String(limit);
return;
}
limit = next;
page = 0;
render();
});
render();
nav.hidden = false;
document.querySelector('#page-size-controls').hidden = false;
})();
</script>
</body>
</html>