Footer

footer.footer

Footer — the site footer: groups of links, then one line of small print.

Examples

Groups of links, then the small print

View “Groups of links, then the small print” as
<footer class="footer">
  <div class="footer-groups">
    <section class="footer-group">
      <h2 class="footer-heading">This site</h2>
      <nav class="nav nav-vertical nav-bare" aria-label="This site">
        <ul class="nav-list">
          <li><a class="nav-link" href="#sources">Sources</a></li>
          <li><a class="nav-link" href="#about">How it is made</a></li>
          <li><a class="nav-link" href="#feed">Feed</a></li>
        </ul>
      </nav>
    </section>

    <section class="footer-group">
      <h2 class="footer-heading">The data</h2>
      <p class="footer-text">Published by the city as open data, downloaded nightly. The
        timetable in force is the one on the platform sign.</p>
    </section>

    <section class="footer-group">
      <h2 class="footer-heading">Preferences</h2>
      <div class="footer-actions">
        <label class="field-label" for="demo-footer-theme">Theme</label>
        <select class="select select-sm" id="demo-footer-theme">
          <option value="system" selected>System</option>
          <option value="light">Light</option>
          <option value="dark">Dark</option>
        </select>
      </div>
    </section>
  </div>

  <div class="footer-bottom">
    <p class="footer-note">Everything happens in your browser: no data leaves this device.</p>
  </div>
</footer>

The sibling of navbar, at the other end of the page, with the same division of labour: this file is the frame, and the links inside it are the nav component.

The columns are auto-fit with a floor rather than a breakpoint, because a footer has two groups on one site and four on the next. .footer-text is capped at the narrow measure on purpose — the failure mode a footer invites is a paragraph of running prose at the bottom of every page, and the shape of the box makes five lines look as wrong as they read.

Tokens 9

Level 2, declared on .footer itself. Set any of them on that selector to restyle this component without touching the skin.

Level 2 tokens declared by footer
TokenDefault
--footer-bgtransparent
--footer-border-colorvar(--color-border-subtle)
--footer-colorvar(--color-on-surface-muted)
--footer-column-size12rem
--footer-font-sizevar(--font-size-sm)
--footer-gapvar(--space-10)
--footer-heading-colorvar(--color-on-surface)
--footer-heading-font-sizevar(--font-size-xs)
--footer-padding-blockvar(--space-12)

Variants and states

Variants

  • .footer-flush

Inside it

  • .footer-actions
  • .footer-bottom
  • .select
  • .btn
  • .footer-group
  • .footer-groups
  • .footer-heading
  • .footer-note
  • .footer-text
  • .input
  • .lang-switch

State it reads

None.

Before you ship it

What you have to do 3 requirements

  1. Give each group's <nav> an aria-label. Two or three navigation landmarks in one footer are announced as "navigation, navigation, navigation" without one. Reuse the visible heading's text.
  2. Use real headings. .footer-heading styles an <h2>; it does not make a <div> into one. A footer's groups are sections of the document, and a screen-reader user navigating by heading is how they get skipped or found.
  3. Push it to the bottom yourself. margin-block-start: auto on the footer of a flex-column <body> with min-block-size: 100dvh is two declarations and it belongs to the page, not here — a footer inside a sidebar layout must not do it.

src/css/components/footer.css · npx mostlycss add footer