Component Library

← Back to gallery

Locale footer in HTML, CSS and vanilla JS

A copy-paste Locale footer in plain HTML and CSS, with vanilla JavaScript: no framework, no build step, MIT-licensed.

Category: Navigation · Tags: footer, locale, region, legal

Live preview

Source (copy-ready)

<section class="dcl-locale-footer" data-dcl-scheme="light" aria-labelledby="dcl-locale-footer-title"><header class="dcl-locale-footer__header"><h2 id="dcl-locale-footer-title">Locale footer</h2><p class="dcl-locale-footer__muted">A persistent region control sits beside legal links and states its effect.</p></header><footer><nav aria-label="Footer"><ul class="dcl-locale-footer__links"><li><a href="#dcl-locale-footer-contact">Contact</a></li><li><a href="#dcl-locale-footer-legal">Legal</a></li></ul></nav><label for="dcl-locale-footer-locale">Region</label><select id="dcl-locale-footer-locale" data-locale><option value="us">United States</option><option value="eu">European Union</option><option value="uk">United Kingdom</option></select><p class="dcl-locale-footer__muted" role="status" aria-live="polite" data-note>US region terms apply in this example.</p></footer><section id="dcl-locale-footer-contact" tabindex="-1" class="dcl-locale-footer__target"><h3>Contact</h3><p>Contact destination.</p></section><section id="dcl-locale-footer-legal" tabindex="-1" class="dcl-locale-footer__target"><h3>Legal</h3><p>Legal destination.</p></section><script>(()=>{const root=document.currentScript.closest(".dcl-locale-footer");if(!root||root.dataset.dclBound)return;root.dataset.dclBound="1";const instance=Array.from(document.getElementsByClassName("dcl-locale-footer")).indexOf(root);if(instance>0){for(const el of [root,...root.querySelectorAll("*")]){for(const attr of ["id","aria-labelledby","aria-controls","aria-describedby","for","name"]){if(el.hasAttribute(attr))el.setAttribute(attr,el.getAttribute(attr)+"--"+instance)}const href=el.getAttribute("href");if(href&&href.startsWith("#"))el.setAttribute("href",href+"--"+instance)}}const preference=matchMedia("(prefers-color-scheme: dark)"),apply=()=>{root.dataset.dclScheme=preference.matches?"dark":"light"};preference.addEventListener("change",apply);apply();const q=(s)=>root.querySelector(s),qa=(s)=>Array.from(root.querySelectorAll(s));const notes={us:"US region terms apply in this example.",eu:"EU privacy terms apply in this example.",uk:"UK controller terms apply in this example."},select=q("[data-locale]"),note=q("[data-note]");select.addEventListener("change",()=>note.textContent=notes[select.value]);})();</script></section>
<style>
.dcl-locale-footer{color:#11292f;background-color:#ffffff;color-scheme:light;font:1rem/1.45 system-ui,sans-serif;padding:.8rem;border:1px solid #697f84;border-radius:.6rem;overflow-wrap:anywhere}
.dcl-locale-footer *{box-sizing:border-box}.dcl-locale-footer h2,.dcl-locale-footer h3{line-height:1.15;margin-block:0 .6rem}.dcl-locale-footer a{color:#005c62}
.dcl-locale-footer button,.dcl-locale-footer input,.dcl-locale-footer select,.dcl-locale-footer textarea,.dcl-locale-footer summary{min-block-size:44px;border:1px solid #697f84;border-radius:.3rem;padding:.4rem .65rem;font:inherit;color:#11292f;background-color:#e4edef}
.dcl-locale-footer input,.dcl-locale-footer select,.dcl-locale-footer textarea{background-color:#ffffff}.dcl-locale-footer input[type="radio"],.dcl-locale-footer input[type="checkbox"]{min-block-size:auto;inline-size:auto}
.dcl-locale-footer button,.dcl-locale-footer summary{cursor:pointer}.dcl-locale-footer button:hover,.dcl-locale-footer summary:hover{color:#ffffff;background-color:#00535a}
.dcl-locale-footer button:focus-visible,.dcl-locale-footer input:focus-visible,.dcl-locale-footer select:focus-visible,.dcl-locale-footer textarea:focus-visible,.dcl-locale-footer summary:focus-visible,.dcl-locale-footer a:focus-visible{outline:3px solid #005c62;outline-offset:2px}
.dcl-locale-footer details{color:#11292f;background-color:#ffffff;border:1px solid #697f84;border-radius:.4rem;margin-block-start:.6rem}.dcl-locale-footer summary{font-weight:650}
.dcl-locale-footer dialog{color:#11292f;background-color:#ffffff;border:1px solid #697f84;border-radius:.6rem;max-inline-size:min(34rem,92vw);padding:1rem}
.dcl-locale-footer table{border-collapse:collapse;inline-size:100%;color:#11292f;background-color:#ffffff}.dcl-locale-footer th,.dcl-locale-footer td{padding:.4rem;text-align:start;border-block-end:1px solid #697f84}.dcl-locale-footer th{color:#11292f;background-color:#e4edef}
.dcl-locale-footer [hidden]{display:none!important}.dcl-locale-footer__muted{color:#405a60}.dcl-locale-footer__panel{color:#405a60;background-color:#ffffff}.dcl-locale-footer__well{color:#11292f;background-color:#e4edef}.dcl-locale-footer__primary,.dcl-locale-footer__badge{color:#ffffff;background-color:#00535a}.dcl-locale-footer__badge{border-radius:999px;padding:.1rem .45rem;font-size:.8rem;font-weight:700}
.dcl-locale-footer[data-dcl-scheme="dark"]{color:#eff8f9;background-color:#142f36;color-scheme:dark;border-color:#839fa5}.dcl-locale-footer[data-dcl-scheme="dark"] a{color:#8fe1da}
.dcl-locale-footer[data-dcl-scheme="dark"] button,.dcl-locale-footer[data-dcl-scheme="dark"] input,.dcl-locale-footer[data-dcl-scheme="dark"] select,.dcl-locale-footer[data-dcl-scheme="dark"] textarea,.dcl-locale-footer[data-dcl-scheme="dark"] summary{color:#eff8f9;background-color:#1c3c44;border-color:#839fa5}
.dcl-locale-footer[data-dcl-scheme="dark"] input,.dcl-locale-footer[data-dcl-scheme="dark"] select,.dcl-locale-footer[data-dcl-scheme="dark"] textarea{background-color:#142f36}.dcl-locale-footer[data-dcl-scheme="dark"] button:hover,.dcl-locale-footer[data-dcl-scheme="dark"] summary:hover{color:#11292f;background-color:#8fe1da}
.dcl-locale-footer[data-dcl-scheme="dark"] button:focus-visible,.dcl-locale-footer[data-dcl-scheme="dark"] input:focus-visible,.dcl-locale-footer[data-dcl-scheme="dark"] select:focus-visible,.dcl-locale-footer[data-dcl-scheme="dark"] textarea:focus-visible,.dcl-locale-footer[data-dcl-scheme="dark"] summary:focus-visible,.dcl-locale-footer[data-dcl-scheme="dark"] a:focus-visible{outline-color:#8fe1da}
.dcl-locale-footer[data-dcl-scheme="dark"] details,.dcl-locale-footer[data-dcl-scheme="dark"] dialog,.dcl-locale-footer[data-dcl-scheme="dark"] table{color:#eff8f9;background-color:#142f36;border-color:#839fa5}.dcl-locale-footer[data-dcl-scheme="dark"] th{color:#eff8f9;background-color:#1c3c44}.dcl-locale-footer[data-dcl-scheme="dark"] th,.dcl-locale-footer[data-dcl-scheme="dark"] td{border-color:#839fa5}
.dcl-locale-footer[data-dcl-scheme="dark"] .dcl-locale-footer__muted{color:#b0c9ce}.dcl-locale-footer[data-dcl-scheme="dark"] .dcl-locale-footer__panel{color:#b0c9ce;background-color:#142f36}.dcl-locale-footer[data-dcl-scheme="dark"] .dcl-locale-footer__well{color:#eff8f9;background-color:#1c3c44}.dcl-locale-footer[data-dcl-scheme="dark"] .dcl-locale-footer__primary,.dcl-locale-footer[data-dcl-scheme="dark"] .dcl-locale-footer__badge{color:#11292f;background-color:#8fe1da}
@media (prefers-reduced-motion:reduce){.dcl-locale-footer *{transition:none!important;animation:none!important}}
.dcl-locale-footer footer{border-block-start:1px solid #697f84;padding-block-start:1rem}.dcl-locale-footer__links{display:flex;gap:1rem;list-style:none;padding:0}.dcl-locale-footer label{font-weight:700}.dcl-locale-footer select{display:block;margin-block:.25rem}</style>

When to use

Use when regional terms genuinely affect the visitor. Make the selected jurisdiction visible close to legal links.

Avoid

Do not use locale controls as decoration or silently alter legal content without preserving the previous state.

Accessibility

Region selection uses a labelled native select and the consequence is repeated as plain text in a live region. Footer links and controls are real native elements with visible focus. Light link text is #005c62 on #ffffff (7.02:1), body text #405a60 on #ffffff (7.37:1); dark link text is #8fe1da on #142f36 (8.72:1), body text #b0c9ce on #142f36 (8.12:1).

Was this useful? Send feedback.