Component Library

← Back to gallery

Project Footer Links in HTML, CSS and vanilla JS

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

Category: Navigation · Tags: footer nav, stack, footer, sitemap

Live preview

Source (copy-ready)

<section class="example-project-footer-links" data-dcl-layout="stack" data-dcl-scheme="light" aria-labelledby="example-project-footer-links-title"><header><h2 id="example-project-footer-links-title">Project Footer Links</h2></header><div class="parts"><section id="example-project-footer-links-item-0" tabindex="-1"><h3>Contribute</h3><p>Read the contribution guide.</p></section><section id="example-project-footer-links-item-1" tabindex="-1"><h3>Licence</h3><p>Read the redistribution terms.</p></section><section id="example-project-footer-links-item-2" tabindex="-1"><h3>Releases</h3><p>See recently shipped versions.</p></section><footer><nav aria-label="Example footer"><ul><li><a href="#example-project-footer-links-item-0">Contribute</a></li><li><a href="#example-project-footer-links-item-1">Licence</a></li><li><a href="#example-project-footer-links-item-2">Releases</a></li></ul></nav></footer></div>
<script>
(() => {
  const root = document.currentScript.closest(".example-project-footer-links");
  const instance = Array.from(document.getElementsByClassName("example-project-footer-links")).indexOf(root);
  if (instance > 0) {
    const references = ["id", "aria-labelledby", "aria-controls", "aria-describedby", "for", "name"];
    for (const element of [root, ...root.querySelectorAll("*")]) {
      for (const attr of references) {
        if (element.hasAttribute(attr)) element.setAttribute(attr, element.getAttribute(attr) + "--" + instance);
      }
      const href = element.getAttribute("href");
      if (href && href.startsWith("#")) element.setAttribute("href", href + "--" + instance);
    }
  }
  const preference = matchMedia("(prefers-color-scheme: dark)");
  const apply = () => { root.dataset.dclScheme = preference.matches ? "dark" : "light"; };
  preference.addEventListener("change", apply);
  apply();

})();
</script></section>
<style>

.example-project-footer-links { color: #11292f; background-color: #ffffff; color-scheme: light; }
.example-project-footer-links a { color: #005c62; }
.example-project-footer-links button, .example-project-footer-links summary, .example-project-footer-links input, .example-project-footer-links select {
  color: #11292f; background-color: #e4edef; border-color: #697f84;
}
.example-project-footer-links button:hover, .example-project-footer-links summary:hover, .example-project-footer-links button[aria-selected="true"] {
  color: #ffffff; background-color: #00535a;
}
.example-project-footer-links dialog { color: #11292f; background-color: #ffffff; }
.example-project-footer-links [data-note] { color: #11292f; background-color: #e4edef; }
.example-project-footer-links :focus-visible { outline: 3px solid #005c62; outline-offset: 2px; }


.example-project-footer-links[data-dcl-scheme="dark"] { color: #eff8f9; background-color: #142f36; color-scheme: dark; }
.example-project-footer-links[data-dcl-scheme="dark"] a { color: #8fe1da; }
.example-project-footer-links[data-dcl-scheme="dark"] button, .example-project-footer-links[data-dcl-scheme="dark"] summary, .example-project-footer-links[data-dcl-scheme="dark"] input, .example-project-footer-links[data-dcl-scheme="dark"] select {
  color: #eff8f9; background-color: #1c3c44; border-color: #839fa5;
}
.example-project-footer-links[data-dcl-scheme="dark"] button:hover, .example-project-footer-links[data-dcl-scheme="dark"] summary:hover, .example-project-footer-links[data-dcl-scheme="dark"] button[aria-selected="true"] {
  color: #11292f; background-color: #8fe1da;
}
.example-project-footer-links[data-dcl-scheme="dark"] dialog { color: #eff8f9; background-color: #142f36; }
.example-project-footer-links[data-dcl-scheme="dark"] [data-note] { color: #eff8f9; background-color: #1c3c44; }
.example-project-footer-links[data-dcl-scheme="dark"] :focus-visible { outline: 3px solid #8fe1da; outline-offset: 2px; }

.example-project-footer-links, .example-project-footer-links * { box-sizing: border-box; }
.example-project-footer-links { font: 1rem/1.5 system-ui, sans-serif; padding: 1rem; border-radius: 0.75rem; overflow-wrap: anywhere; }
.example-project-footer-links h2, .example-project-footer-links h3 { line-height: 1.15; margin-block: 0 0.75rem; }
.example-project-footer-links p { margin-block: 0.5rem; }
.example-project-footer-links ul { margin-block: 0.5rem; padding-inline-start: 1.5rem; }
.example-project-footer-links article, .example-project-footer-links details, .example-project-footer-links [data-note] { border: 1px solid; border-radius: 0.375rem; padding: 0.75rem; }
.example-project-footer-links button, .example-project-footer-links summary, .example-project-footer-links input, .example-project-footer-links select {
  min-block-size: 44px; border: 1px solid; border-radius: 0.375rem; padding: 0.5rem 0.75rem; font: inherit;
}
.example-project-footer-links button, .example-project-footer-links summary { cursor: pointer; transition: background-color 140ms ease-out; }
.example-project-footer-links button:disabled { cursor: not-allowed; text-decoration: line-through; }
.example-project-footer-links input { display: block; inline-size: 100%; }
.example-project-footer-links dialog { max-inline-size: min(32rem, 90vw); border-radius: 0.75rem; padding: 1rem; }
.example-project-footer-links th, .example-project-footer-links td { padding: 0.5rem; text-align: start; border-block-end: 1px solid; }
.example-project-footer-links table { border-collapse: collapse; inline-size: 100%; }
.example-project-footer-links caption { font-weight: bold; text-align: start; }
.example-project-footer-links dt { font-weight: 600; }
.example-project-footer-links dd { margin: 0 0 0.75rem; }
.example-project-footer-links [hidden] { display: none !important; }
.example-project-footer-links .parts { display: grid; gap: 1rem; }

@media (max-width: 30rem) {
  .example-project-footer-links[data-dcl-layout="rail"] .parts { grid-template-columns: minmax(0, 1fr); }
  .example-project-footer-links[data-dcl-layout="rail"] .parts > :is(p, ul, article) { grid-column: 1; grid-row: auto; }
  .example-project-footer-links[data-dcl-layout="rail"] .parts > :is(details, nav) { grid-row: auto; }
}
@media (prefers-reduced-motion: reduce) { .example-project-footer-links * { transition: none !important; } }
</style>

When to use

Use this stacked pattern to give each item a full-width row.

Avoid

Do not make the footer the only path to an essential destination.

Accessibility

Name the footer navigation landmark and keep labels meaningful without nearby headings.

Was this useful? Send feedback.