HTML and CSS · Chapter 12 of 12
Launch night
By the end of this chapter you can take a whole small site from "nearly" to "live": check every page at a phone's width and a laptop's, lay a page out for both, give form fields the states people need (where the keyboard is, what is wrong), make a form a screen reader can use, and find three different bugs with three different tools. Then you answer Ira's interview round. Build it in your browser: a real editor and terminal, AI that explains, and tests that tell you when it works.
- Part: CSS: the layout
- 4 tasks
- HTML and CSS
- In the all labs plan
The first 2 chapters of HTML and CSS are free. This one comes with the all labs plan.
Why you need this
It is Thursday 3 April 2025, the night before Parda's launch. The site is nearly there: the home page is finished, with the launch show and the twelve venues. Four pieces are not. The show page for The Last Show at Moti Mahal has no layout at all. The contact form gives no sign of where the keyboard is or what was typed wrong. Datta rebuilt the form this afternoon, and a screen reader now announces almost nothing. And Kala Talkies' page, the one Sayali will show the venue owners first, has three bugs.
Nothing in this chapter is new except one pseudo-class. Every task is something from chapters 1 to 11, used on a real page, at two widths, the way a site is checked before it goes live.
What you build: 4 tasks
Each task has tests. You write the code in the lab's editor and press Check.
- Task 1
show.css: the show page on a phone and a laptop
In show.css, lay out show.html's article (class show-page), mobile first. Under 800 px wide it is a grid of one column: the poster (class poster), the details (class details), the showtimes (class times) and the prices (class aside), one under another in that order, 16px apart, each as wide as the page's column. From 800 px wide it has two columns, 1 share and 2 shares, a gap of 16px, and the named areas poster details, then poster times, then aside aside: the poster fills the first column of the first two rows, the details and the showtimes sit to its right, one above the other, and the aside runs across both columns at the bottom.
The Check measures show.html at 400, 799, 800 and 1000 px wide, and the page must never scroll sideways.
- Task 2
form.css: the fields' focus and invalid states
In form.css, give contact.html's form fields (every input, select and textarea) two states. While a field has the keyboard's focus (focus-visible): border-color #7a1c2e, an outline of 3px solid #f0b94d and an outline-offset of 2px. After someone has filled in an input or the textarea wrongly and left it (user-invalid): border-color #b8324a.
A field nobody has touched keeps parda.css's #eadfce border, even when it is required and empty. The Check presses Tab to reach the first field, then types asha@ in the email field and presses Tab (red), then asha@parda.example and Tab (back to #eadfce).
- Task 3 · interview question
Interview: contact.html, the form a screen reader cannot use
Fix Datta's form in contact.html so that every field has a label tied to it that says, exactly: Name (the name field), Email (the email field), Phone (10 digits) (the phone field), Venue (the select) and Message (the textarea). Put the four radio buttons in a group named What is it about?, a fieldset with that legend, each radio button named by its own label: Tickets, A refund, Getting there, Something else. Keep every field's name, type and rules, the Send button, and the page's skeleton with its title Write to us: Parda. The placeholders may go.
Ira will ask: what does a label do, and how does a screen reader know which radio buttons belong together?
- Task 4 · interview question
Interview: kala-talkies.html, the page with three bugs
Fix Kala Talkies' page (kala-talkies.html and kala-talkies.css), keeping its skeleton and its title Kala Talkies, Sadashiv Peth: Parda, without !important. First, the heading Box office hours is an h2 of its own, and the two lines under it, Open 11 am to 10 pm, every day. and The box office opens an hour before the first show., are paragraphs. Second, the three seat prices (class price) show as Ira's rule says: color #7a1c2e, font-size 20px, font-weight 700. Third, at 400 px wide the page never scrolls sideways: the three facts (in the element with class facts) wrap onto as many rows as they need, inside the column, and at 1000 px wide they still sit side by side in one row.
Ira will ask: three bugs, three tools: how did you find each one?
What you will learn
- A page at every width: one column on a phone, named areas from 800 px, in one stylesheet.
- :focus-visible and :user-invalid: where the keyboard is, and a field that is wrong after someone has used it.
- A form everyone can use: a <label> for every field and a <fieldset> with a <legend> for radio buttons, not placeholders.
- Debugging with the right tool: lab tree for the structure, lab style for the cascade, lab box for the layout.
More in CSS: the layout
Build "Launch night" yourself
Parda is launching its first website for Pune's own cinemas and stages. You build it, page by page. A real editor and terminal in your browser, AI that explains, and a Check that says when it works.
The first 2 chapters of HTML and CSS are free. This one comes with the all labs plan.