Web Development Pro | Lesson 020 | CSS Project: A Responsive Workshop Site
Web Development Pro · Lesson 20 of 60
Module 2: CSS and responsive design
In this lesson
Prerequisites and learning outcomes
Complete lesson 19 first. This lesson builds on responsive design integration. By the end, you can deliver a styled accessible site verified at narrow, wide, and zoomed layouts. Plan 10–15 minutes for the core explanation and additional time for the worked practice.
Turn the HTML prototype into a responsive site
This project adds a coherent visual system to the workshop site from lesson 10. The home page, schedule, and practice form should feel related, remain readable on narrow screens, and support visible keyboard focus. Keep the fictional-data and no-booking messages. Styling should make the existing purpose clearer without changing what the site actually does.
Copy the HTML project into a new milestone folder so the original remains available for comparison. Add one shared styles.css file and link it from all pages, including the separate demo preview. You can use the supplied reference project to compare structure and rules, but complete the checks on your own version rather than assuming a copied file is automatically verified.
Define a small design system
Choose a text color, surface color, accent, spacing scale, and readable type hierarchy. Reuse them through custom properties. Limit paragraph line length and let containers shrink. Provide enough padding for comfortable reading without forcing a fixed width that exceeds the viewport. The same rules should accommodate longer headings and enlarged text.
:root { --ink: #243746; --surface: #fff; --accent: #174b36; --space: 1rem; }
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; font: 1rem/1.6 system-ui, sans-serif; color: var(--ink); background: var(--surface); }
header, main, footer { width: min(100% - 2rem, 65rem); margin-inline: auto; }
nav { display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; }
nav a { padding-block: 0.6rem; }
a { color: var(--accent); }
a[aria-current="page"] { font-weight: 700; text-decoration-thickness: 0.18em; }
img { max-width: 100%; height: auto; }
a:focus-visible, input:focus-visible, select:focus-visible, button:focus-visible {
outline: 3px solid #8a2400; outline-offset: 3px;
}
The complete stylesheet includes headings, form spacing, table cells, and the skip link. This excerpt shows the shared foundation. Keep rules grouped so a reviewer can find the global defaults and the component-specific additions. Do not solve every local spacing issue by changing the global body size.
Adapt the schedule and form carefully
The schedule remains a semantic table with its caption and scoped headers. Give cells clear spacing and allow ordinary text to wrap. A wrapper can provide horizontal scrolling if the table becomes wider than its container. If that region needs keyboard focus for scrolling, give it an understandable accessible name and test the focus path.
A table wrapper is not a reason to make the whole page scroll sideways. Check that its width stays within the page container. Also ensure the scroll area does not clip focus indicators or hide the fact that more columns exist. For this small schedule, wrapping may be sufficient at many widths, but the fallback should still preserve the data.
Form controls should use readable text and clear labels with visible spacing. A fieldset's legend remains meaningful after styling. Do not remove borders so aggressively that the relationship between grouped choices disappears. Keep submit and any other button types explicit, and preserve the native validation attributes from the HTML project.
Add responsive enhancements sparingly
The home page can use a two-column arrangement for its introduction and supporting details when sufficient space exists. At narrow widths, preserve the natural source order. The navigation can wrap rather than requiring a custom menu. The site does not need JavaScript simply to demonstrate responsive design.
Use a breakpoint because the content benefits from the change. Test the transition with the longest heading, not only the shortest one. Avoid fixed heights on cards, headers, and form panels. The layout should grow when content grows, even if that makes a screenshot less symmetrical than a rigid mockup.
If you add motion, provide a reduced-motion alternative and keep essential information independent of the effect. The reference project keeps the overall experience mostly static. A calm, readable site with reliable focus states is a stronger result than a visually elaborate one that obscures navigation.
Assemble a real review matrix
Check each page at a narrow width, a wide width, and enlarged text. Check every navigation route with a pointer and keyboard. Check the current-page marker, skip link, table readability, form labels, and validation. Review color pairs for body text, links, warning text, and focus indicators in their actual contexts.
The supplied automated evidence covers static document structure, local targets, limited stylesheet checks, and numeric color calculations. Browser launch was restricted during authoring, so responsive rendering, focus movement, native validation, and assistive-technology checks remain unrun in that environment. A learner or reviewer with browser access should complete those gates before presenting the project as visually validated.
Record defects as reproducible observations. “The schedule wrapper clips its focus outline at 320 CSS pixels” identifies an element, condition, and symptom. “Make mobile better” does not. Fix one cause at a time, rerun the affected journey, and check that another page using the shared stylesheet did not regress.
Prepare the handoff
Include the files, a brief README, the expected entry page, and a test checklist with passed, failed, and not-run states. Explain that the form is a static demonstration and no real booking service exists. The result is a styled local prototype, with release readiness dependent on the remaining manual checks, rather than an externally deployed website.
Keep this milestone for the JavaScript phase. Later behavior should enhance the same content and visual system. A working visual foundation makes it easier to distinguish a styling problem from a state-management or event-handling problem when interactivity arrives.
Worked practice
Worked exercise 1: Find a shared-style regression
Task: Increasing global link padding makes paragraph links awkward. Worked answer: keep generous padding scoped to navigation links or button-like controls instead of all anchors. Text links and navigation targets have different layout roles even when they share a color.
Worked exercise 2: Preserve table access
Task: The schedule is wider than a narrow viewport. Worked answer: first allow reasonable cell wrapping, then use a constrained, labeled scroll wrapper if needed. Keep the table's caption and headers. Hiding the last column would remove information instead of adapting its presentation.
Worked exercise 3: Write an honest completion note
Task: Static tests pass, but no browser was available. Worked answer: describe the project as a complete local implementation with static checks passed and manual browser gates pending. Name those gates explicitly rather than calling the entire site visually verified.
Knowledge check
Question 1
Why use one shared stylesheet here? A) To make page-specific review unnecessary. B) To keep recurring visual decisions consistent. C) To guarantee layouts adapt to every width. D) To scope every component rule automatically to its own page.
Check question 1: answer and explanation
Answer: B. Shared rules reduce drift while still requiring cross-page review.
Question 2
Which response preserves a wide table's information? A) Keep only columns that fit in the first viewport. B) Apply overflow: hidden to the whole page. C) Use deliberate wrapping or a constrained scroll region. D) Set a fixed desktop table width and allow the whole page to overflow.
Check question 2: answer and explanation
Answer: C. The data and its relationships remain available.
Question 3
What should styling preserve in the practice form? A) Labels, grouping, constraints, and truthful demo wording. B) Visible labels alone, with programmatic associations removed. C) Native constraints alone, with the explanatory demo wording removed. D) Visual field grouping alone, with the fieldset and legend removed.
Check question 3: answer and explanation
Answer: A. Presentation must not undermine the form's semantics or truthfulness.
Question 4
What is needed before claiming responsive rendering passed? A) Matching media-query text and balanced CSS braces alone. B) A checklist of intended viewport sizes without recorded observations. C) A screenshot at one wide viewport alone. D) Actual browser observations at relevant sizes.
Check question 4: answer and explanation
Answer: D. Static structure cannot establish rendered behavior.
Question 5
Why keep the earlier HTML milestone? A) To assume unchanged source order proves unchanged accessibility. B) To compare enhancements against a known content foundation. C) To treat any visual difference as a defect automatically. D) To replace regression checks with a source-file comparison.
Check question 5: answer and explanation
Answer: B. The baseline helps isolate changes and preserve useful semantics.