Footer
Footer — the site footer: groups of links, then one line of small print.
Examples
<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.
| Token | Default |
|---|---|
| --footer-bg | transparent |
| --footer-border-color | var(--color-border-subtle) |
| --footer-color | var(--color-on-surface-muted) |
| --footer-column-size | 12rem |
| --footer-font-size | var(--font-size-sm) |
| --footer-gap | var(--space-10) |
| --footer-heading-color | var(--color-on-surface) |
| --footer-heading-font-size | var(--font-size-xs) |
| --footer-padding-block | var(--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
- Give each group's
<nav>anaria-label. Two or three navigation landmarks in one footer are announced as "navigation, navigation, navigation" without one. Reuse the visible heading's text. - Use real headings.
.footer-headingstyles 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. - Push it to the bottom yourself.
margin-block-start: autoon the footer of a flex-column<body>withmin-block-size: 100dvhis 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