This is the part 2 checkpoint. No new concepts — just the whole toolbox, used together.
The goal isn’t to copy this exact design. The goal is to see how the pieces fit: tokens first, then layout, then components, then states, then responsive rules.
The order matters
Don’t write CSS from the top of the page to the bottom and hope. Use this order:
- Tokens — colors, spacing, radius, fonts in
:root. - Reset —
box-sizing, margins, images, form fonts. - Page shell — body, header, main, footer.
- Layout — grid/flex for the big regions.
- Components — panels, fields, buttons, cards, tables.
- States — hover, focus, disabled.
- Responsive — a couple of media queries at the end.
That order means you’re never styling a component before you know what space it lives in.
The demo
Here’s the full page. It’s a single-column, mobile-first layout — the preview panel is narrow, so this is what it looks like on a phone. On a wider screen, the form and results become two columns.
Edit the code, then hit Run (or Ctrl + Enter) and watch the preview. This is a safe sandbox — you can't break the page.
The pieces worth stealing
Even if you design your own version, these patterns are reusable:
/* 1. Tokens */
:root {
--brand: #4f46e5;
--space-4: 16px;
--radius: 18px;
}
/* 2. Responsive two-column layout */
.layout {
display: grid;
gap: var(--space-4);
}
@media (min-width: 760px) {
.layout {
grid-template-columns: 1.4fr 0.8fr;
align-items: start;
}
}
/* 3. Auto-fitting fields */
.field-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
gap: 12px;
}
/* 4. A calm focus state */
input:focus-visible {
border-color: var(--brand);
box-shadow: 0 0 0 4px var(--brand-soft);
outline: none;
}
Make it yours
the plan's verify stepApply this CSS to your own page, or copy the demo and change the palette, font, radius, and spacing tokens. Then add one component of your own: a goal badge, a progress bar, or a small note card. Keep using the tokens.
Bonus: add a dark version with @media (prefers-color-scheme: dark) by changing the token values in :root.
Before you move on
- The page works at 320px wide with no sideways scrolling.
- Body text is readable and contrast is comfortable.
- Every interactive element has hover and focus-visible states.
- Spacing uses the scale, not random numbers.
- The table scrolls inside its wrapper on small screens.
- No
!importantexcept the reduced-motion block. - You can explain what every line in your
:rootdoes.
Build CSS in order: tokens, reset, shell, layout, components, states, responsive.
A grid layout with one breakpoint handles most page structures.
Reusable patterns: auto-fit fields, focus rings, result cards.
Design by subtraction — remove before you add.
The page is static; JavaScript is next.
That’s part 2. Your calculator looks like a real product. Now we make it work.
Next: JavaScript basics — values, variables, and strings.
Up next
JavaScript basics: values, variables, and strings
JavaScript is the behavior layer. Start with the pieces you'll use every day: variables, types, strings, and the console — then make the page do something.