Video Chapter Markers
A video progress bar split into chapters: click a segment to jump, and the active chapter highlights.
AI prompt
Clean UI mockup of a video player control bar at the bottom of a dark video frame, the progress bar divided into five segments of different lengths with thin gaps, the third segment partly filled in white with a round playhead, a small tooltip above it reading Setting up the project, to the left a play button and the time 1:12 / 4:30, below the player a list of five chapters with timestamps and the current one highlighted, light and dark neutral palette, flat modern style. Negative: heavy gradients, clutter, text errors, device frames. Reduced motion: static design.About this pattern
Definition
Chapters split a long video into named parts. The progress bar is divided into segments proportional to each chapter, the current one is highlighted, and hovering shows its title. People can jump straight to what they want, which makes explainers and tutorials far easier to use.
When to use it
- Segment widths follow chapter length, with a small gap between segments.
- Show the chapter title near the playhead and in a list beside or below.
- Clicking a segment seeks to its start; keyboard users can use the chapter list.
- Keep titles short, a few words each.
What the controls do
- Play and Pause, a chapter bar and a chapter list.
Motion & timing
- Progress advances in real time through a 24 second demo.
- Reduced motion: no autoplay; click to seek.
Tips & variations
- Provide a text list of chapters with times so the structure is also available without the bar.
- Do not rely on colour alone to show the active chapter.
Code of this live preview
<div class="bx"><div class="vp"><div class="fr" id="fr"><span id="ti"></span></div><div class="ct"><button class="pb" id="pl" type="button" aria-label="Play">▶</button><div class="bar" id="br"></div><span class="tm" id="tm">0:00</span></div></div><ol class="ls" id="ls"></ol></div>:root{--bg:#F1F1EF;--surface:#fff;--surface-2:#F7F7F5;--line:#E0E0DC;--text:#171717;--muted:#6f6f6f;--accent:#171717;--accent-ink:#fff;--danger:#d92d20}
*{box-sizing:border-box;margin:0}
button{font:inherit;color:inherit;background:none;border:0;padding:0;cursor:pointer}a{color:inherit;text-decoration:none}ul,ol,p,h4{margin:0;padding:0}.sr-only{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
.pre{display:flex;gap:5px;flex-wrap:wrap}.pre button{height:28px;padding:0 11px;border-radius:99px;border:1px solid var(--line);background:var(--surface);font-size:11px;cursor:pointer}
.pre button[aria-pressed=true]{background:var(--accent);color:var(--accent-ink);border-color:var(--accent)}
.bx{width:min(330px,100%);display:grid;gap:9px}.rw{display:grid;gap:3px;font-size:11.5px;color:var(--muted)}.rw b{color:var(--text);font-weight:600}input[type=range]{width:100%;accent-color:#171717}
.out{font-size:12px;color:var(--muted);line-height:1.4}.out b{color:var(--text)}
button:focus-visible,input:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
.vp{background:#14141a;border-radius:12px;overflow:hidden}.fr{height:70px;display:grid;place-items:center;color:#fff;font-size:13px;font-weight:600;background:linear-gradient(135deg,var(--h1),var(--h2))}.ct{display:flex;align-items:center;gap:8px;padding:8px 10px;color:#fff}.pb{width:26px;height:26px;border-radius:50%;background:#fff;color:#14141a;font-size:10px}.bar{flex:1;display:flex;gap:3px;height:14px;align-items:center;position:relative}.bar button{height:5px;background:rgba(255,255,255,.3);border-radius:3px;position:relative;transition:height .12s;padding:0}.bar button:hover,.bar button:focus-visible{height:9px}.bar button i{position:absolute;left:0;top:0;bottom:0;background:#fff;border-radius:3px;width:0}.bar button.on{background:rgba(255,255,255,.45)}.tm{font-size:11px;min-width:30px;text-align:right}.ls{list-style:none;display:grid;gap:2px;font-size:12px;margin-top:8px}.ls li button{width:100%;display:flex;justify-content:space-between;padding:4px 8px;border-radius:6px;text-align:left}.ls li button[aria-current=true]{background:#171717;color:#fff}.ls li button span{opacity:.6}@media (prefers-reduced-motion:reduce){.bar button{transition:none}}
@media (prefers-reduced-motion:reduce){*{transition:none!important;animation:none!important}}const CH=[['Intro',0,4],['Setup',4,6],['Build',10,8],['Test',18,3],['Ship',21,3]],T=24,br=document.getElementById('br'),ls=document.getElementById('ls'),fr=document.getElementById('fr'),ti=document.getElementById('ti'),pl=document.getElementById('pl'),tm=document.getElementById('tm'),calm=matchMedia('(prefers-reduced-motion:reduce)').matches;let pos=0,play=false,last=0;
br.innerHTML=CH.map((c,i)=>'<button type="button" data-i="'+i+'" style="flex:'+c[2]+'" aria-label="Chapter '+(i+1)+': '+c[0]+'"><i></i></button>').join('');
ls.innerHTML=CH.map((c,i)=>'<li><button type="button" data-i="'+i+'"><b>'+(i+1)+'. '+c[0]+'</b><span>'+Math.floor(c[1]/60)+':'+String(c[1]%60).padStart(2,'0')+'</span></button></li>').join('');
const bb=[...br.children],lb=[...ls.querySelectorAll('button')];
function f(s){return Math.floor(s/60)+':'+String(Math.floor(s%60)).padStart(2,'0');}
function up(){let cur=0;CH.forEach((c,i)=>{if(pos>=c[1])cur=i;});CH.forEach((c,i)=>{const k=Math.max(0,Math.min(1,(pos-c[1])/c[2]));bb[i].firstChild.style.width=(k*100)+'%';bb[i].classList.toggle('on',i===cur);lb[i].setAttribute('aria-current',String(i===cur));});fr.style.setProperty('--h1','hsl('+(220+cur*28)+',55%,28%)');fr.style.setProperty('--h2','hsl('+(260+cur*28)+',55%,40%)');ti.textContent=(cur+1)+'. '+CH[cur][0];tm.textContent=f(pos);}
function loop(n){if(!play)return;pos=Math.min(T,pos+(n-last)/1000);last=n;up();if(pos>=T){play=false;pl.textContent='\u25b6';return;}requestAnimationFrame(loop);}
function seek(i){pos=CH[i][1];up();}
pl.addEventListener('click',()=>{if(play){play=false;pl.textContent='\u25b6';pl.setAttribute('aria-label','Play');return;}if(pos>=T)pos=0;play=true;pl.textContent='\u2161';pl.setAttribute('aria-label','Pause');requestAnimationFrame(n=>{last=n;loop(n);});});
[br,ls].forEach(e=>e.addEventListener('click',ev=>{const b=ev.target.closest('button[data-i]');if(b)seek(+b.dataset.i);}));
up();if(!calm)setTimeout(()=>pl.click(),300);One complete HTML file. Save it and open it in a browser.
<!doctype html>
<html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Video Chapter Markers — demo</title>
<style>
:root{--bg:#F1F1EF;--surface:#fff;--surface-2:#F7F7F5;--line:#E0E0DC;--text:#171717;--muted:#6f6f6f;--accent:#171717;--accent-ink:#fff;--danger:#d92d20}
*{box-sizing:border-box;margin:0}
html,body{height:100%}body{background:var(--bg);color:var(--text);font:15px/1.5 -apple-system,BlinkMacSystemFont,'Segoe UI',Inter,Roboto,sans-serif;-webkit-font-smoothing:antialiased}.stage{min-height:100%;display:grid;place-items:center;padding:24px}button,input,select,textarea{font-family:inherit}@media (prefers-reduced-motion:reduce){html{scroll-behavior:auto}}
button{font:inherit;color:inherit;background:none;border:0;padding:0;cursor:pointer}a{color:inherit;text-decoration:none}ul,ol,p,h4{margin:0;padding:0}.sr-only{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
.pre{display:flex;gap:5px;flex-wrap:wrap}.pre button{height:28px;padding:0 11px;border-radius:99px;border:1px solid var(--line);background:var(--surface);font-size:11px;cursor:pointer}
.pre button[aria-pressed=true]{background:var(--accent);color:var(--accent-ink);border-color:var(--accent)}
.bx{width:min(330px,100%);display:grid;gap:9px}.rw{display:grid;gap:3px;font-size:11.5px;color:var(--muted)}.rw b{color:var(--text);font-weight:600}input[type=range]{width:100%;accent-color:#171717}
.out{font-size:12px;color:var(--muted);line-height:1.4}.out b{color:var(--text)}
button:focus-visible,input:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
.vp{background:#14141a;border-radius:12px;overflow:hidden}.fr{height:70px;display:grid;place-items:center;color:#fff;font-size:13px;font-weight:600;background:linear-gradient(135deg,var(--h1),var(--h2))}.ct{display:flex;align-items:center;gap:8px;padding:8px 10px;color:#fff}.pb{width:26px;height:26px;border-radius:50%;background:#fff;color:#14141a;font-size:10px}.bar{flex:1;display:flex;gap:3px;height:14px;align-items:center;position:relative}.bar button{height:5px;background:rgba(255,255,255,.3);border-radius:3px;position:relative;transition:height .12s;padding:0}.bar button:hover,.bar button:focus-visible{height:9px}.bar button i{position:absolute;left:0;top:0;bottom:0;background:#fff;border-radius:3px;width:0}.bar button.on{background:rgba(255,255,255,.45)}.tm{font-size:11px;min-width:30px;text-align:right}.ls{list-style:none;display:grid;gap:2px;font-size:12px;margin-top:8px}.ls li button{width:100%;display:flex;justify-content:space-between;padding:4px 8px;border-radius:6px;text-align:left}.ls li button[aria-current=true]{background:#171717;color:#fff}.ls li button span{opacity:.6}@media (prefers-reduced-motion:reduce){.bar button{transition:none}}
@media (prefers-reduced-motion:reduce){*{transition:none!important;animation:none!important}}
</style></head>
<body><div class="stage">
<div class="bx"><div class="vp"><div class="fr" id="fr"><span id="ti"></span></div><div class="ct"><button class="pb" id="pl" type="button" aria-label="Play">▶</button><div class="bar" id="br"></div><span class="tm" id="tm">0:00</span></div></div><ol class="ls" id="ls"></ol></div>
</div>
<script>
const CH=[['Intro',0,4],['Setup',4,6],['Build',10,8],['Test',18,3],['Ship',21,3]],T=24,br=document.getElementById('br'),ls=document.getElementById('ls'),fr=document.getElementById('fr'),ti=document.getElementById('ti'),pl=document.getElementById('pl'),tm=document.getElementById('tm'),calm=matchMedia('(prefers-reduced-motion:reduce)').matches;let pos=0,play=false,last=0;
br.innerHTML=CH.map((c,i)=>'<button type="button" data-i="'+i+'" style="flex:'+c[2]+'" aria-label="Chapter '+(i+1)+': '+c[0]+'"><i></i></button>').join('');
ls.innerHTML=CH.map((c,i)=>'<li><button type="button" data-i="'+i+'"><b>'+(i+1)+'. '+c[0]+'</b><span>'+Math.floor(c[1]/60)+':'+String(c[1]%60).padStart(2,'0')+'</span></button></li>').join('');
const bb=[...br.children],lb=[...ls.querySelectorAll('button')];
function f(s){return Math.floor(s/60)+':'+String(Math.floor(s%60)).padStart(2,'0');}
function up(){let cur=0;CH.forEach((c,i)=>{if(pos>=c[1])cur=i;});CH.forEach((c,i)=>{const k=Math.max(0,Math.min(1,(pos-c[1])/c[2]));bb[i].firstChild.style.width=(k*100)+'%';bb[i].classList.toggle('on',i===cur);lb[i].setAttribute('aria-current',String(i===cur));});fr.style.setProperty('--h1','hsl('+(220+cur*28)+',55%,28%)');fr.style.setProperty('--h2','hsl('+(260+cur*28)+',55%,40%)');ti.textContent=(cur+1)+'. '+CH[cur][0];tm.textContent=f(pos);}
function loop(n){if(!play)return;pos=Math.min(T,pos+(n-last)/1000);last=n;up();if(pos>=T){play=false;pl.textContent='\u25b6';return;}requestAnimationFrame(loop);}
function seek(i){pos=CH[i][1];up();}
pl.addEventListener('click',()=>{if(play){play=false;pl.textContent='\u25b6';pl.setAttribute('aria-label','Play');return;}if(pos>=T)pos=0;play=true;pl.textContent='\u2161';pl.setAttribute('aria-label','Pause');requestAnimationFrame(n=>{last=n;loop(n);});});
[br,ls].forEach(e=>e.addEventListener('click',ev=>{const b=ev.target.closest('button[data-i]');if(b)seek(+b.dataset.i);}));
up();if(!calm)setTimeout(()=>pl.click(),300);
</script>
</body></html>