NavigationFree
Responsive Navigation Menu
A site header whose links fold behind a Menu button on phones and sit in a row from 40em, written without a library.
A breadcrumb trail and a numbered pager with previous, next and gaps, built from real links that fold to a compact pager on phones.
Checked on 3 December 2026 in Chrome 143.0.7499.169: 12 automated checks. What the checks are
<section class="bcp" aria-labelledby="bcp-title">
<nav class="bcp__crumbs" aria-label="Breadcrumb">
<ol class="bcp__trail">
<li><a href="#">Home</a></li>
<li><a href="#">Library</a></li>
<li><a href="#">Guides</a></li>
<li><a href="#" aria-current="page">Layout patterns</a></li>
</ol>
</nav>
<h2 class="bcp__title" id="bcp-title">Layout patterns</h2>
<ul class="bcp__results">
<li class="bcp__result"><span class="bcp__no">41</span><a href="#">Centring without tricks</a></li>
<li class="bcp__result"><span class="bcp__no">42</span><a href="#">A grid that reflows by itself</a></li>
</ul>
<nav class="bcp__pager" aria-label="Pagination">
<ul class="bcp__pages">
<li>
<a class="bcp__step" href="#" rel="prev">
<svg class="bcp__icon" viewBox="0 0 16 16" width="16" height="16" aria-hidden="true" focusable="false"><path d="M10 3 5 8l5 5" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>
<span>Previous</span>
</a>
</li>
<li class="bcp__far"><a class="bcp__page" href="#" aria-label="Page 1">1</a></li>
<li class="bcp__far" aria-hidden="true"><span class="bcp__gap">…</span></li>
<li><a class="bcp__page" href="#" aria-label="Page 4">4</a></li>
<li><a class="bcp__page" href="#" aria-label="Page 5" aria-current="page">5</a></li>
<li><a class="bcp__page" href="#" aria-label="Page 6">6</a></li>
<li class="bcp__far" aria-hidden="true"><span class="bcp__gap">…</span></li>
<li class="bcp__far"><a class="bcp__page" href="#" aria-label="Page 12">12</a></li>
<li>
<a class="bcp__step" href="#" rel="next">
<span>Next</span>
<svg class="bcp__icon" viewBox="0 0 16 16" width="16" height="16" aria-hidden="true" focusable="false"><path d="m6 3 5 5-5 5" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>
</a>
</li>
</ul>
<p class="bcp__count">Page 5 of 12 · results 41 to 50 of 118 · example data</p>
</nav>
</section>.bcp {
--bcp-bg: #ffffff;
--bcp-tint: #f3f4fb;
--bcp-ink: #1c2033;
--bcp-muted: #4b5266;
--bcp-line: #d5d9e6;
--bcp-accent: #4338ca;
--bcp-on-accent: #ffffff;
--bcp-focus: #1c2033;
box-sizing: border-box;
width: 100%;
max-width: 38rem;
padding: 1.25rem 1.25rem 1.5rem;
color: var(--bcp-ink);
background: var(--bcp-bg);
border: 1px solid var(--bcp-line);
border-radius: 16px;
box-shadow: 0 1px 2px rgba(28, 32, 51, 0.06), 0 8px 24px -12px rgba(28, 32, 51, 0.18);
}
.bcp *, .bcp *::before, .bcp *::after { box-sizing: inherit; }
/* Breadcrumb */
.bcp__trail { display: flex; flex-wrap: wrap; align-items: center; gap: 0.15rem 0; margin: 0; padding: 0; list-style: none; font-size: 0.875rem; }
.bcp__trail li { display: inline-flex; align-items: center; }
.bcp__trail li + li::before {
content: "\203A";
content: "\203A" / "";
margin: 0 0.45rem;
color: var(--bcp-muted);
font-size: 1.1em;
}
.bcp__trail a { padding: 0.25rem 0.2rem; color: var(--bcp-accent); text-decoration: none; border-radius: 4px; }
.bcp__trail a:hover { text-decoration: underline; text-underline-offset: 3px; }
.bcp__trail a[aria-current="page"] { color: var(--bcp-ink); font-weight: 650; }
.bcp__title { margin: 0.9rem 0 0.9rem; font-size: 1.5rem; line-height: 1.2; letter-spacing: -0.01em; }
/* Result rows */
.bcp__results { margin: 0 0 1.1rem; padding: 0; list-style: none; border-top: 1px solid var(--bcp-line); }
.bcp__result { display: flex; align-items: baseline; gap: 0.9rem; padding: 0.7rem 0.1rem; border-bottom: 1px solid var(--bcp-line); }
.bcp__no { min-width: 2ch; color: var(--bcp-muted); font-variant-numeric: tabular-nums; font-size: 0.85rem; }
.bcp__result a { color: var(--bcp-ink); font-weight: 550; text-decoration: none; border-radius: 4px; }
.bcp__result a:hover { color: var(--bcp-accent); text-decoration: underline; text-underline-offset: 3px; }
/* Pager */
.bcp__pages { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 0.35rem; margin: 0; padding: 0; list-style: none; }
.bcp__page, .bcp__step, .bcp__gap {
display: inline-flex; align-items: center; justify-content: center;
min-width: 2.75rem; min-height: 2.75rem;
font-size: 0.95rem; font-variant-numeric: tabular-nums;
}
.bcp__page, .bcp__step {
color: var(--bcp-ink);
text-decoration: none;
border: 1px solid var(--bcp-line);
border-radius: 10px;
transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.bcp__step { gap: 0.4rem; padding: 0 0.85rem; font-weight: 600; }
.bcp__page:hover, .bcp__step:hover { background: var(--bcp-tint); border-color: var(--bcp-accent); color: var(--bcp-accent); }
.bcp__page[aria-current="page"] { color: var(--bcp-on-accent); background: var(--bcp-accent); border-color: var(--bcp-accent); font-weight: 700; }
.bcp__gap { min-width: 1.5rem; color: var(--bcp-muted); }
.bcp__count { margin: 0.9rem 0 0; text-align: center; color: var(--bcp-muted); font-size: 0.85rem; }
.bcp a:focus-visible { outline: 3px solid var(--bcp-focus); outline-offset: 2px; }
/* Phones: keep previous, the current page's neighbours and next on one line */
@media (max-width: 30rem) {
.bcp { padding: 1rem; }
.bcp__trail { font-size: 0.8125rem; }
.bcp__trail li + li::before { margin: 0 0.25rem; }
.bcp__trail a { padding: 0.25rem 0.1rem; }
.bcp__far { display: none; }
.bcp__step span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.bcp__step { padding: 0; }
}
@media (prefers-reduced-motion: reduce) {
.bcp__page, .bcp__step { transition: none; }
}
@media (prefers-color-scheme: dark) {
.bcp {
--bcp-bg: #1c2033;
--bcp-tint: #272c45;
--bcp-ink: #eceef8;
--bcp-muted: #b3b9d0;
--bcp-line: #3d4466;
--bcp-accent: #b4b9ff;
--bcp-on-accent: #14172a;
--bcp-focus: #ffffff;
box-shadow: none;
}
}Written by the author of the snippet. Each note has a test step or a markup check that reads the page.
NavigationA site header whose links fold behind a Menu button on phones and sit in a row from 40em, written without a library.
NavigationTwo side panels, one from each edge, that open over the page as native modal dialogs and give focus back to their button when they close.
NavigationA tab list with three panels, arrow-key, Home and End support and roving tabindex, built with the XON tabs words.