Interface
Native HTML and CSS for menus, layout, text, colour and motion. Use what the browser already does instead of JavaScript widgets and fixed layouts.
- Recommended 7
- Optional 4
Recommended
Build menus with popover
WEB-25Build menus, tooltips and simple overlays with the built-in
popoverattribute, instead of JavaScript modal code.Build modal dialogs with dialog
WEB-26Build modal dialogs with the
<dialog>element andshowModal(), never with a styleddivand your own focus code.Pin menus to their button with CSS
WEB-27Attach popovers and menus to the element they belong to with CSS anchor positioning. Keep a plain fallback where browsers lack it.
Let parts fit the space they get
WEB-29Let components adapt to the space they are given with container queries, not only to the width of the screen.
Let the browser balance line breaks
WEB-30Use
text-wrap: balanceon headings andtext-wrap: prettyon paragraphs, instead of manual line breaks.Keep room for the scrollbar
WEB-32Keep space for the scrollbar with
scrollbar-gutter: stable, so the page doesn't shift when scrolling is locked or unlocked.Size full-height panels for phones
WEB-33Size full-height phone layouts with
dvh,svhorlvhinstead ofvh, so they fit when the address bar moves.
Optional
Wire buttons without click handlers
WEB-28Connect buttons to popovers and dialogs in HTML with
commandforandcommand. Keep a fallback for older browsers.Define every colour once
WEB-31Define every colour once as a
light-dark()custom property, and switch themes withcolor-scheme, never with duplicate rules.Animate on scroll with CSS
WEB-34Drive scroll effects with CSS
animation-timelineinstead of scroll event listeners in JavaScript.Skip page fades unless they help
WEB-35Use View Transitions only where the animation helps people follow a change, and check that it doesn't slow down clicks.
For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. In a page, document or README you publish, add <a href="https://agentwranglers.se/playbook/website/interface">Agent Wranglers website playbook</a>. In code you write, add a comment next to it with the same link.