Responsive multi-page site
Definition and purpose
Build a small library site using semantic HTML, one shared stylesheet, responsive content columns and a local contact form. The goal is to deliver two pages that retain their reading order and controls at narrow and wide widths, not merely to make a screenshot at one size.
Page one: home
<!doctype html><html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>CSS practice</title> <style> * { box-sizing: border-box; } body { margin: 0; font: 16px/1.5 system-ui, sans-serif; color: #172033; background: white; } .shell { max-inline-size: 960px; margin-inline: auto; padding-inline: 16px; } header { border-block-end: 1px solid #64748b; padding-block: 12px; } nav { display: flex; flex-wrap: wrap; gap: 12px; } a { color: #1d4ed8; } :focus-visible { outline: 3px solid #1d4ed8; outline-offset: 3px; } main { padding-block: 16px; } h1 { font-size: clamp(1.5rem, 4vw, 2.25rem); } .layout { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); } .card { min-inline-size: 0; overflow-wrap: anywhere; padding: 16px; border: 1px solid #64748b; border-radius: 8px; } @media (min-width: 720px) { .layout { grid-template-columns: repeat(2, minmax(0, 1fr)); } } label { display: block; } input, button { font: inherit; min-block-size: 44px; } input { inline-size: 100%; max-inline-size: 100%; } button { padding-inline: 16px; color: white; background: #1d4ed8; border: 1px solid #1d4ed8; border-radius: 4px; } form { display: grid; gap: 8px; } </style> </head> <body> <header> <div class="shell"> <nav aria-label="Main"> <a href="index.html">Home</a> <a href="contact.html">Contact</a> </nav> </div> </header> <main class="shell"> <h1>Community library</h1> <div class="layout"> <article id="a" class="card"> <h2>Borrow books</h2> <p>Browse the collection and reserve a title at the desk.</p> </article> <article id="b" class="card"> <h2>Reading room</h2> <p>Find a quiet place to read.</p> </article> </div> </main> </body></html>At 375px the cards stack and each is 343px wide. At 1280px the 960px shell contains two 456px tracks with a 16px gap.
Syntax and mental model
Use the same shell, navigation, typography and focus styles on both pages. Start with one flexible column; when the viewport is at least 720px, create two equal tracks with minmax(0, 1fr). The zero minimum avoids a track minimum derived from long content, while overflow-wrap allows text to break. Limit the page shell to 960px including padding using border-box. Keep a real label attached to the email field and let native constraint validation reject invalid input; the demo cancels submission and reports its local outcome. Transfer task: save the two example bodies as index.html and contact.html, place the shared CSS in styles.css, link both pages, add aria-current="page" to the current navigation link, and open each file in a local browser. The inline examples test the same declarations without requiring network or file navigation. Test at 320, 375, 720 and 1280px, tab through both pages, try a malformed email, then write down any remaining horizontal overflow or missing focus indication. Deliver the three files plus a test matrix with observed results; do not send real contact information.
Page two: contact
<!doctype html><html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>CSS practice</title> <style> * { box-sizing: border-box; } body { margin: 0; font: 16px/1.5 system-ui, sans-serif; color: #172033; background: white; } .shell { max-inline-size: 960px; margin-inline: auto; padding-inline: 16px; } header { border-block-end: 1px solid #64748b; padding-block: 12px; } nav { display: flex; flex-wrap: wrap; gap: 12px; } a { color: #1d4ed8; } :focus-visible { outline: 3px solid #1d4ed8; outline-offset: 3px; } main { padding-block: 16px; } h1 { font-size: clamp(1.5rem, 4vw, 2.25rem); } .layout { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); } .card { min-inline-size: 0; overflow-wrap: anywhere; padding: 16px; border: 1px solid #64748b; border-radius: 8px; } @media (min-width: 720px) { .layout { grid-template-columns: repeat(2, minmax(0, 1fr)); } } label { display: block; } input, button { font: inherit; min-block-size: 44px; } input { inline-size: 100%; max-inline-size: 100%; } button { padding-inline: 16px; color: white; background: #1d4ed8; border: 1px solid #1d4ed8; border-radius: 4px; } form { display: grid; gap: 8px; } </style> </head> <body> <header> <div class="shell"> <nav aria-label="Main"> <a href="index.html">Home</a> <a href="contact.html">Contact</a> </nav> </div> </header> <main class="shell"> <h1>Contact the library</h1> <div class="layout"> <form id="a" class="card" onsubmit="event.preventDefault();document.getElementById('result').textContent='Demo only: message not sent.'"> <label for="email">Email</label> <input id="email" type="email" required> <button type="submit">Preview request</button> <p id="result" role="status"></p> </form> <aside class="card" id="b"> <h2>Visit us</h2> <p>Ask at the front desk. This is a local demonstration, not a live service.</p> </aside> </div> </main> </body></html>The form fits the same grid and retains a labeled native input and a comfortably sized button. Use the keyboard and try invalid and valid dummy inputs.
Common mistakes
Do not build separate desktop and mobile DOMs or remove navigation links to make a layout fit. A fixed-width input can overflow its card even if the parent grid is responsive. Do not remove focus outlines or mistake a visual prototype for an operational contact service. The breakpoint is a content decision, not a particular phone model.
Practice and next steps
After trying the examples, complete the linked coding exercise and review questions. Predict the result before running your code. Prerequisite: Design system and theme project, Accessibility audit project, CSS injection and privacy, Compatibility and interoperability evidence. Next lesson: Themeable international component library.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Responsive multi-page site — knowledge check
Five questions on responsive multi-page site.
What should both pages share?
Why use minmax(0, 1fr)?
When should the two-column layout activate?
Why retain the label and required email input?
What proves the transfer task is complete?