Back to templates

Launch countdown timer

A live countdown banner showing days, hours, minutes, and seconds to a target release.

Source code

1 lines · 1.5 KB
<style>*{box-sizing:border-box}body{margin:0;font-family:Inter,system-ui,sans-serif;background:#f6f7fb;color:#172033}button,a{font:inherit}.wrap{width:min(960px,calc(100% - 32px));margin:auto}</style><style>main{min-height:100vh;display:grid;place-items:center;padding:24px;background:radial-gradient(circle at top,#dbeafe,#f8fafc 55%)}.panel{text-align:center;max-width:620px}.grid{display:grid;grid-template-columns:repeat(4,1fr);gap:12px;margin:28px 0}.cell{background:#fff;border:1px solid #dbe2ef;border-radius:14px;padding:18px 10px}.cell strong{display:block;font-size:36px;font-variant-numeric:tabular-nums}.cell span{font-size:12px;color:#64748b;text-transform:uppercase}@media(max-width:520px){.grid{grid-template-columns:repeat(2,1fr)}}</style><main><section class="panel"><h1>Public v2.0 ships in</h1><div class="grid"><div class="cell"><strong id="d">00</strong><span>Days</span></div><div class="cell"><strong id="h">00</strong><span>Hours</span></div><div class="cell"><strong id="m">00</strong><span>Minutes</span></div><div class="cell"><strong id="s">00</strong><span>Seconds</span></div></div><p style="color:#475569">Single-file countdown with zero external dependencies.</p></section></main><script>const target=Date.now()+14*864e5;function tick(){const diff=Math.max(0,target-Date.now());const d=Math.floor(diff/864e5),h=Math.floor(diff/36e5)%24,m=Math.floor(diff/6e4)%60,s=Math.floor(diff/1e3)%60;for(const[k,v]of[["d",d],["h",h],["m",m],["s",s]])document.getElementById(k).textContent=String(v).padStart(2,"0")}tick();setInterval(tick,1000)</script>

When this template fits

Use this countdown layout for beta launches, webinar start times, event deadlines, or seasonal announcements embedded in a single link.

How the layout works

Four equal metric cells display days, hours, minutes, and seconds with tabular numerals and collapse from 4 columns to 2 on narrow phones.

What to customize

Set a fixed ISO target timestamp in UTC with time zone context, and replace the countdown with a direct launch link once time reaches zero.

Review before publishing

Verify the target date in multiple time zones, test the 00:00:00:00 boundary state, and ensure zero horizontal overflow on 320px screens.

Keep building with context

Compare a related pattern or read a practical guide before adapting this example in the Playground.