Tutorials
8 short tutorials with 24 examples. Each example runs on the page and opens in the Playground, where you can change it. The reading times are estimates from the word count.
-
Build a to-do list: plain JavaScript, then XON
Handle many buttons with one listener, keep state in one object, draw the list without innerHTML, then write the same list with XON.
- HTML
- JavaScript
- XON
-
Centring and aligning with Flexbox
Centre one item, space several items, push one to the far end and wrap a row, with the few Flexbox properties that do the work.
- CSS
-
CSS transitions and animations with reduced motion
Animate a state change with a transition, repeat with a keyframe animation, and switch both off for people who ask for less motion.
- CSS
-
Dark mode with CSS variables and a switch
Keep colours in custom properties, follow the system's dark setting, and add a switch that overrides it and remembers the choice.
- CSS
- JavaScript
-
Form validation with HTML and a little JavaScript
Use the browser's own form rules first, tie every error message to its field and add an error summary with a little script.
- HTML
- CSS
- JavaScript
- XON
-
A modal dialog with the dialog element
Open a native dialog as a modal, give it a name, close it three ways and send focus back to the button that opened it.
- HTML
- JavaScript
- XON
-
A responsive card grid without media queries
Lay out cards with auto-fit and minmax, scale space and type with clamp, and let a card adapt to its own width with a container query.
- CSS
-
A responsive navigation menu that folds on a phone
Build a menu that is a plain list of links, sits in a row on wide screens and folds behind a button on a phone.
- HTML
- CSS
- JavaScript