Sub topic 16
Footer markup and responsive layout
This chapter assumes you can write semantic HTML and CSS, know the box model, and have read the earlier chapters on navigation landmarks and footer content. Here you will mark up a footer so assistive technology can find it, then lay it out so it works from phones to wide screens.
Choose the right elements
A footer needs three things: a footer element, a labeled nav for its link groups, and a text line for copyright.
<footer>
<nav aria-label="Footer">
<section>
<h2>Company</h2>
<ul>
<li><a href="/about">About</a></li>
<li><a href="/careers">Careers</a></li>
<li><a href="/contact">Contact</a></li>
</ul>
</section>
<section>
<h2>Legal</h2>
<ul>
<li><a href="/privacy">Privacy policy</a></li>
<li><a href="/terms">Terms of use</a></li>
</ul>
</section>
</nav>
<p><small>© 2026 Example Co.</small></p>
</footer>Each part has a job:
- A
footerthat is a direct child ofbodyis exposed as thecontentinfolandmark. Afooterinside anarticleorsectionis not, so keep the page-level footer outside those elements. - The
aria-label="Footer"on thenavseparates it from the primary navigation. A page with two unlabelednavelements gives screen reader users two identical landmarks. - Each group has a heading, so users can jump between groups with heading navigation. Use
h2here because the footer groups are peers of the main content sections. Do not skip levels to get a smaller font. Change the size in CSS. - Each group's links sit in a
ul, so a screen reader announces the number of items. smallmarks side text such as copyright and legal notices. It is not a way to shrink text.
Lay it out responsively
Style the footer so it needs no breakpoints. A grid with auto-fit and minmax() places as many columns as fit and stacks the groups on a narrow screen.
footer {
padding: 1.5rem 1rem;
background: #f4f4f4;
}
footer nav {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
gap: 1.5rem;
}
footer h2 {
margin: 0 0 0.5rem;
font-size: 1rem;
}
footer ul {
margin: 0;
padding: 0;
list-style: none;
}
footer a {
display: inline-block;
padding: 0.6rem 0;
}
footer a:focus-visible {
outline: 3px solid #1a5fd0;
outline-offset: 2px;
}
footer p {
margin-top: 1.5rem;
}The minmax(10rem, 1fr) value sets the narrowest a column may get. Below roughly 20rem of container width the grid drops to one column. Links are plain text, so the vertical padding on a makes the touch target taller. Without it, stacked links are hard to tap accurately.
Setting list-style: none on a list can make some screen readers stop announcing it as a list. Because the footer groups are short and each has a heading, this loss is usually acceptable. Test it with your target screen readers.
<br>
Check your work
- Tab through the footer. Focus should move in reading order and show a visible outline.
- Resize to 320 px wide. Nothing should scroll sideways.
- Open a landmarks list in a screen reader. You should see one
Footernavigation and onecontentinfo.
Exercise
A page has a primary nav and a footer nav, both written as plain <nav> with no other attributes. What is the problem for screen reader users, and what is the fix?
Show answer
Both appear in the landmarks list as "navigation" with no way to tell them apart. Add an accessible name to each, for example aria-label="Primary" and aria-label="Footer".