Skip link and visible focus
NavigationGive keyboard users a direct route past repeated navigation and into the page.
HTML + CSS + JavaScript
<a href="#main-content">Skip to content</a> Navigation · Complete runnable example
Keep a section index in step with the current reading position.
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 a section index for a longer document with meaningful headings. The desktop index stays beside the article; narrow screens place it before the text so it does not obscure the reading area.
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 | Keep your place.</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;
}
}
html {
scroll-padding-top: 0;
}
.reading-layout {
display: grid;
grid-template-columns: 220px minmax(0, 1fr);
gap: 55px;
align-items: start;
}
.contents {
position: sticky;
top: 24px;
padding-top: 18px;
border-top: 2px solid var(--accent);
}
.contents > .small {
font-size: 9px;
margin-bottom: 17px;
color: var(--muted);
}
.contents a {
display: flex;
gap: 11px;
align-items: baseline;
padding: 12px 10px;
border-left: 3px solid transparent;
text-decoration: none;
color: #50615a;
font-size: 12px;
line-height: 1.6;
}
.contents a > span {
font: 9px var(--mono);
color: #4f6350;
}
.contents a[aria-current='location'] {
background: #e6ecdf;
border-color: var(--accent);
color: #183b2b;
font-weight: 600;
}
.contents-note {
font-size: 11px;
color: var(--muted);
border-top: 1px solid var(--line);
margin-top: 20px;
padding-top: 18px;
}
.essay-section {
padding: 28px 0 45px;
border-top: 1px solid var(--line);
scroll-margin-top: 30px;
min-height: 550px;
}
.essay-section h2 {
font-size: 38px;
max-width: 14ch;
}
.essay-section > p:not(.eyebrow) {
font-size: 16px;
color: #465954;
line-height: 1.9;
margin-top: 24px;
}
.question {
background: #e9eddc;
border-left: 3px solid #647749;
padding: 23px;
margin-top: 28px;
}
.question > span {
font: 9px var(--mono);
color: #4d6540;
}
.question > p {
font-size: 19px;
line-height: 1.5;
letter-spacing: -0.02em;
margin-top: 11px;
}
@media (max-width: 720px) {
.reading-layout {
grid-template-columns: 1fr;
gap: 28px;
}
.contents {
position: static;
padding-top: 15px;
}
.contents a {
padding: 8px 10px;
}
.contents > .small {
margin-bottom: 10px;
}
.contents-note {
display: none;
}
.essay-section {
min-height: 0;
padding: 27px 0 40px;
scroll-margin-top: 20px;
}
.essay-section h2 {
font-size: 33px;
}
.essay-section > p:not(.eyebrow) {
font-size: 15px;
line-height: 1.85;
margin-top: 22px;
}
.question {
padding: 22px;
}
.question > p {
font-size: 18px;
}
}
</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">05 / ACTIVE TABLE OF CONTENTS</p>
<h1>Keep your place.</h1>
<p>
A short field guide to thoughtful prototypes. The section index
follows your reading position and remains ordinary anchor navigation
without JavaScript.
</p>
</div>
<noscript
><p>
The section links still work as normal anchors. Automatic
current-section highlighting requires JavaScript.
</p></noscript
>
<div class="reading-layout">
<nav class="contents" aria-label="On this page">
<p class="small">ON THIS PAGE</p>
<a href="#question"><span>01</span>Start with a question</a
><a href="#shape"><span>02</span>Give the idea a shape</a
><a href="#observe"><span>03</span>Watch the awkward moments</a
><a href="#record"><span>04</span>Leave a useful record</a>
<p class="contents-note">
Four notes.<br />One useful starting point.
</p>
</nav>
<article class="essay" aria-label="A thoughtful prototype">
<section
id="question"
class="essay-section"
aria-labelledby="heading-question"
>
<p class="eyebrow">FIELD NOTE / 01</p>
<h2 id="heading-question" tabindex="-1">Start with a question</h2>
<p>
Before choosing a format, write down the uncertainty you want to
resolve. A useful question names the people involved and the
decision that comes next.
</p>
<p>
A small prototype can test whether the language is understandable.
It cannot establish whether an entire product will succeed. Match
the question to something you can actually observe.
</p>
<aside class="question">
<span>ASK YOURSELF</span>
<p>What would you need to see before changing direction?</p>
</aside>
</section>
<section
id="shape"
class="essay-section"
aria-labelledby="heading-shape"
>
<p class="eyebrow">FIELD NOTE / 02</p>
<h2 id="heading-shape" tabindex="-1">Give the idea a shape</h2>
<p>
Choose a small, complete example. Real labels and realistic
content reveal more than empty boxes, especially when the text is
long or the screen is narrow.
</p>
<p>
Keep the structure plain enough to change. Separate the essential
behavior from decorative polish so an early revision does not
require rebuilding every detail.
</p>
<aside class="question">
<span>ASK YOURSELF</span>
<p>What is the smallest honest version of this idea?</p>
</aside>
</section>
<section
id="observe"
class="essay-section"
aria-labelledby="heading-observe"
>
<p class="eyebrow">FIELD NOTE / 03</p>
<h2 id="heading-observe" tabindex="-1">
Watch the awkward moments
</h2>
<p>
Try the example with a keyboard, a narrow screen, and an
unfamiliar task. Notice where you hesitate, where focus goes, and
which labels need explanation.
</p>
<p>
An empty result or a failed action is still part of the interface.
Write those messages while the behavior is small enough to
understand, then test that the result matches the words.
</p>
<aside class="question">
<span>ASK YOURSELF</span>
<p>What happens when the comfortable path is interrupted?</p>
</aside>
</section>
<section
id="record"
class="essay-section"
aria-labelledby="heading-record"
>
<p class="eyebrow">FIELD NOTE / 04</p>
<h2 id="heading-record" tabindex="-1">Leave a useful record</h2>
<p>
Write down what changed, what remains uncertain, and why a
particular tradeoff was acceptable. The next person needs context
as much as they need the current files.
</p>
<p>
Keep observations separate from promises. A short trial can reveal
a problem without proving that it has been solved for every person
or device.
</p>
<aside class="question">
<span>ASK YOURSELF</span>
<p>What will someone need to know when they revisit this?</p>
</aside>
</section>
</article>
</div>
<p class="note">
The index reflects scroll position, not reading completion. No progress
or browsing history is stored.
</p>
</main>
<footer class="footer wrap">
<span>MRHTML / Original runnable example</span
><span>Local content. No network required.</span>
</footer>
<script>
(() => {
'use strict';
const links = [...document.querySelectorAll('.contents a')];
const sections = links.map((link) =>
document.getElementById(link.hash.slice(1)),
);
let frame = 0;
function current() {
const offset = 36;
let active = sections[0];
sections.forEach((section) => {
if (section.getBoundingClientRect().top <= offset) active = section;
});
if (
innerHeight + scrollY >=
document.documentElement.scrollHeight - 3
)
active = sections[sections.length - 1];
links.forEach((link) => {
if (link.hash === '#' + active.id)
link.setAttribute('aria-current', 'location');
else link.removeAttribute('aria-current');
});
}
function schedule() {
cancelAnimationFrame(frame);
frame = requestAnimationFrame(current);
}
links.forEach((link, index) =>
link.addEventListener('click', (event) => {
event.preventDefault();
const heading = sections[index].querySelector('h2');
heading.focus({ preventScroll: true });
sections[index].scrollIntoView({
behavior: matchMedia('(prefers-reduced-motion: reduce)').matches
? 'auto'
: 'smooth',
block: 'start',
});
schedule();
}),
);
if ('IntersectionObserver' in window) {
const observer = new IntersectionObserver(schedule, {
rootMargin: '-36px 0px -50% 0px',
threshold: [0, 0.1, 0.5, 1],
});
sections.forEach((section) => observer.observe(section));
}
window.addEventListener('scroll', schedule, { passive: true });
window.addEventListener('resize', schedule);
current();
})();
</script>
</body>
</html>