Unit C · A page somebody else can use
What we are making: the same page, but readable at arm's length on a phone. This is the session that makes your project look finished.
Somebody walks past your device, glances at the screen for about four seconds, and walks on. In that time they should get one number, what it means, and how old it is. Anything else on the page is competing with those three things.
That is the whole of design for this year. The rest is typography.
Every other session you fill slots. Today you go into pageHead() and change the
style block, because that is what it is there for — and it is the only part of the staple
you ever edit.
It is the viewport line. Without it a phone assumes your page was designed for a desktop monitor and shrinks the whole thing to fit — which is why your page has looked like a postage stamp until now. Add it and everything becomes readable instantly.
pageHead() from every page you will ever build. That is why one change today changes all of them — including your project in May. Teams who instead paste the style into each page separately end up with five pages that look slightly different from each other, and no way to fix them all at once.| What you see | Why | What to do |
|---|---|---|
| It still looks tiny on a phone | The viewport line is missing or misspelled. | It goes in the head, before the style. |
| The style does nothing | The style block is in the body. | It belongs between <head> and </head>. |
| Quotes cause compile errors | Double quotes inside a C++ string. | Use single quotes in your HTML attributes. It is legal HTML. |
| Colours look fine on a laptop, awful on a phone | Phone screens are dimmer outdoors. | Test it where it will actually be used. |
In this session