
Modern Web Platform Practices for Coding Agents
Use when you build a web UI component, pick a native HTML and CSS feature with its browser fallback, fix Core Web Vitals.
You can read the contents and the first 2,000 characters.
Pro includes the whole book.
- By Condensed from Google Chrome's Modern Web Guidance (Apache-2.0)
- 65 chapters
- Updated Nov 14, 2026
- 4 readers
What you’ll get
- Build dialogs, popovers, menus and selects with native HTML instead of libraries
- Know which web features need a fallback for your browser targets, and which one
- Fix LCP, INP and CLS with fetch priority, task scheduling and stable fonts
- Add passkeys, Trusted Types and safe HTML sanitization correctly
- Animate with view transitions and scroll-driven CSS instead of JS libraries
From the first page
Scope: native HTML, CSS and client-side JavaScript for web UI, forms, accessibility, visual design, performance, security and privacy, web components, dates, built-in AI, WebMCP, PWA and WebAssembly. Not covered: backend, build tooling, Chrome extensions.
Checked against: npm modern-web-guidance v1.0.0 (skill version 20261109-5bcc021b), Baseline data as shipped in that release.
Reviewed: 2026-11-14. Next review: 2027-02-14.
Licence: Apache-2.0 (derived from Google Chrome's Modern Web Guidance, Apache-2.0; see the last page for attribution).
This book tells a coding agent how to build web UI and client-side features with today's native HTML, CSS and JavaScript instead of legacy patterns or extra dependencies, and which fallback to ship for browsers that lack a feature. It condenses Google Chrome's Modern Web Guidance (npm modern-web-guidance v1.0.0, 208 expert-reviewed guides, Apache-2.0, built with the Firefox and Edge teams). It is an unofficial derivative; see the last page for sources, license and upkeep.
Preview · 2,000 of 523,106 characters
Contents
- 01Modern Web Platform Practices for Coding Agentsp.1
- When to load this bookp.1
- Three questions this book answers better than model memoryp.1
- How to use itp.1
- Page indexp.1
- 02Decision matrix: task to pagep.2
- 03Foundations: Browser support policy and how to apply this bookp.3
- The problem this book solvesp.3
- Reading support statementsp.3
- Carrying vanilla guidance into frameworksp.3
- Verifying the resultp.3
- Modernizing an existing codebasep.3
- 04Accessibility: Core guidelines for structure, names, keyboard and mediap.4
- Accessibility coding guidelinesp.4
- 05Accessibility: Form errors, generated content and OS text scalep.5
- Accessible error announcementp.5
- Accessible generated contentp.5
- Respect operating system text scalep.5
- 06User experience: Content first, form factors and natural interactionsp.6
- Maximize content and reduce noisep.6
- Adapt to the form factorp.6
- Implement natural interactionsp.6
- 07UI atoms: Icons, component themes and anchored overlaysp.7
- Using and managing iconsp.7
- Component-specific light/dark themesp.7
- Viewport-aware dropdownsp.7
- Position-aware tooltipsp.7
- 08UI atoms: Scroll-driven and scroll-state effectsp.8
- Carousel slide effectsp.8
- Scroll progress indicatorp.8
- Shrinking header on scrollp.8
- State-aware sticky headersp.8
- Scroll position aware elementsp.8
- Pull to revealp.8
See all 65 parts
- 09UI atoms: Overflowing content - tables, truncation and scroll hintsp.9
- Responsive tablesp.9
- Single-line text overflowp.9
- Scrollability affordance hintsp.9
- 10CSS: Architecture, cascade, functions and feature detectionp.10
- Modern CSS architecture *(guide: css)*p.10
- Reusable CSS functions *(guide: reduce-style-repetition)*p.10
- Conditional CSS on at-rule support *(guide: atrule-support-conditionals)*p.10
- 11CSS: Layout, container queries and responsive sizingp.11
- Modern CSS layout *(guide: css-layout)*p.11
- Responsive design entry point *(guide: responsive-design)*p.11
- Size-aware components *(guide: size-aware-styling)*p.11
- Fluid scaling with container units *(guide: fluid-scaling)*p.11
- 12CSS: Parent and sibling-aware styling with :has() and sibling functionsp.12
- Styling a container from child state *(guide: child-state-based-styling)*p.12
- Layout from content presence *(guide: content-based-styling)*p.12
- Styling a form group when a field is invalid *(guide: style-parent-with-has)*p.12
- Styling siblings by count and index *(guide: dynamic-sibling-styling)*p.12
- 13CSS: Container style queries for context, tokens and combined conditionsp.13
- Usage-aware component variations *(guide: usage-aware-component-variations)*p.13
- Reactive design tokens *(guide: design-token-reactivity)*p.13
- Combining selectors with @-rules *(guide: selector-atrule-combinations)*p.13
- 14CSS: Intrinsic-size animation, individual transforms and clippingp.14
- Animating to intrinsic sizes *(guide: animate-to-intrinsic-sizes)*p.14
- Calculating with intrinsic sizes *(guide: calculate-with-intrinsic-sizes)*p.14
- Individual transform properties *(guide: individual-transform-properties)*p.14
- Overflow clipping control *(guide: overflow-clipping-control)*p.14
- 15HTML: Semantics, overlays, disclosure, focus, forms and resource loadingp.15
- Modern HTML architecture *(guide: html)*p.15
- 16HTML: Web components: when to build, lifecycle, Shadow DOM and server renderingp.16
- Web components orientation *(guide: web-components)*p.16
- Custom elements *(guide: custom-elements)*p.16
- Shadow DOM, templates and slots *(guide: shadow-dom)*p.16
- Pre-rendering custom elements *(guide: prerendering-custom-elements)*p.16
- 17HTML: Web components: styling, accessibility and form controlsp.17
- Styling web components *(guide: styling-web-components)*p.17
- Accessible web components *(guide: accessible-web-components)*p.17
- Form-associated custom elements *(guide: form-associated-custom-elements)*p.17
- 18Forms: Foundations for accessible, secure form buildingp.18
- Form best practicesp.18
- 19Forms: Autofill for sign-in, sign-up, address and paymentp.19
- Shared rules for all four flowsp.19
- Sign-in formp.19
- Sign-up formp.19
- Address formp.19
- Payment formp.19
- 20Forms: One-time codes and autofill stylingp.20
- SMS one-time passcode formp.20
- Styling autofilled fieldsp.20
- 21Forms: Validation timing and IME-safe submitp.21
- Shared pattern: deferred errors with ARIA syncp.21
- Validate input after interactionp.21
- Required field feedbackp.21
- Required select menup.21
- IME-safe Enter-to-submitp.21
- 22Forms: Styling native controlsp.22
- Brand-colored form controls with accent-colorp.22
- Custom range sliderp.22
- Switch togglep.22
- Form fields that fit their contentp.22
- 23Forms: Customizable selectp.23
- Shared rules for every customizable selectp.23
- Branded select stylingp.23
- Animated select pickerp.23
- Custom picker layoutsp.23
- Rich media pickerp.23
- 24UI components: Dialogs, hovercards, toasts and toursp.24
- Dialogp.24
- Hovercardp.24
- Toast notificationsp.24
- Onboarding toursp.24
- 25UI components: Popup menus, menu bars and toolbarsp.25
- Popup menup.25
- Application menu barp.25
- Toolbarp.25
- 26UI components: Navbars, drawers, breadcrumbs and scrollspyp.26
- Responsive navbarp.26
- Navigation drawerp.26
- Breadcrumbsp.26
- Scrollspyp.26
- 27UI components: Carousels and stack drill-down navigationp.27
- Carouselp.27
- Stack drill-downp.27
- 28UI components: Accordions, tabs and cardsp.28
- Accordionp.28
- Tabsp.28
- Cardp.28
- 29UI components: Progress bars, progress rings and spinnersp.29
- Progress barp.29
- Progress ringp.29
- Loading spinnerp.29
- 30UI components: Checkboxes, copy buttons and dark mode togglesp.30
- Checkboxp.30
- Copy buttonp.30
- Dark mode togglep.30
- 31UI behaviors: Dialogs, popovers and button commandsp.31
- Declarative dialog and popover controlp.31
- Custom button actionsp.31
- Light-dismiss a dialogp.31
- Platform controls dismiss a dialogp.31
- Prevent page scroll under a modal dialogp.31
- 32UI behaviors: Tooltips, interest previews and anchored indicatorsp.32
- Interest-triggered tooltipsp.32
- Interest-triggered action previewsp.32
- Anchor-positioned tab underlinep.32
- 33UI behaviors: Motion, entry/exit animation and easingp.33
- Motion fundamentalsp.33
- Animate element entry and exitp.33
- Animate to and from the top layerp.33
- Physics-based easingp.33
- Stagger sibling animationsp.33
- 34UI behaviors: View transitionsp.34
- Same-document transitionsp.34
- Group element transitionsp.34
- Directional navigation transitionsp.34
- Scoped component transitionsp.34
- Cross-document transitionsp.34
- Consistent cross-document transitionsp.34
- 35UI behaviors: Scroll-driven effectsp.35
- Scroll entry and exit effectsp.35
- Parallax scroll effectsp.35
- Scrollytellingp.35
- Interactive content revealp.35
- 36UI behaviors: Scroll snap carousels and scroll positionp.36
- Carousel snap highlightsp.36
- Scroll snap real-time feedbackp.36
- Scroll snap state syncp.36
- Scroll target on loadp.36
- Scroll completion effectsp.36
- Two-dimensional panningp.36
- 37UI behaviors: Swipe gestures and dragging floating elementsp.37
- Swipe to removep.37
- Swipe to revealp.37
- Drag a floating elementp.37
- 38UI behaviors: Reordering and moving DOM elementsp.38
- Move a DOM element without losing statep.38
- Persistent top-layer UIp.38
- Drag and drop to reorderp.38
- Dynamic sortp.38
- Sortable tablep.38
- 39UI behaviors: Findable hidden content, text highlights and arrow-key navigationp.39
- Search hidden contentp.39
- Highlight text rangesp.39
- Spatial navigationp.39
- 40Visual design: Color, contrast and dark modep.40
- Accessible color, forced colors and tintsp.40
- Readable text on a dynamic backgroundp.40
- Dark mode with color-scheme and light-dark()p.40
- 41Visual design: Theming browser UI and scrollbarsp.41
- Theming browser-generated UIp.41
- Scrollbar color and thicknessp.41
- High-contrast scrollbarsp.41
- 42Visual design: Typography, line wrapping and text alignmentp.42
- Typography fundamentalsp.42
- Balanced and pretty line breaksp.42
- Precise vertical text alignmentp.42
- Equal-width lines in headline lockupsp.42
- 43Visual design: Font stability and text decorationsp.43
- Visually stable font fallbacksp.43
- Visually stable mixed fontsp.43
- Custom text decorationsp.43
- 44Visual design: Masks, shapes, gradients and effectsp.44
- Masking fundamentals (shared by the sections below)p.44
- Free-form shapes with masksp.44
- Shaped cutouts and notchesp.44
- Soft edge fadep.44
- Texture and weatheringp.44
- Shadows, blend modes, gradients and patternsp.44
- 45Visual design: HTML in canvas (2D, WebGL, WebGPU, Three.js)p.45
- Shared recipe: drawable canvas, paint, textures, geometryp.45
- WebGL shaders on HTML contentp.45
- Interactive HTML in 3D scenesp.45
- Export HTML as images or videop.45
- 46Performance: Loading fundamentals, render path and render-blocking scriptsp.46
- Web performance fundamentalsp.46
- Flicker-free client-side A/B testingp.46
- Conditional async dependencies with top-level awaitp.46
- 47Performance: Fetch priority, lazy loading, images and mediap.47
- Optimize image priorityp.47
- Optimize preload priorityp.47
- Optimize script priorityp.47
- Deprioritize background fetchesp.47
- Lazy load video and audiop.47
- Deliver optimized decorative imagesp.47
- Resolution-optimized pseudo-elementsp.47
- 48Performance: Next page loads, HTML streaming and SPA viewsp.48
- Improve next page load performancep.48
- Out-of-order HTML streamingp.48
- Faster SPA view switches via state cachingp.48
- 49Performance: Main thread, scrolling and rendering workp.49
- Break up long tasksp.49
- Schedule tasks by priorityp.49
- Defer work until scroll endsp.49
- Defer rendering heavy contentp.49
- Interactions in complex layoutsp.49
- Efficient background processingp.49
- 50Performance: Measuring INP, heavy scripts and interaction paintsp.50
- Identify causes of poor INPp.50
- Identify heavy-running JavaScriptp.50
- Measure interaction and soft-navigation paint timingp.50
- 51Performance: Analytics beacons and page visibilityp.51
- Reliably measure full-session analyticsp.51
- Debounce and batch analytics eventsp.51
- Calculate total foreground timep.51
- Detect initial visibility statep.51
- 52PWA: Installing web apps and migrating their originp.52
- Install web appsp.52
- Migrate an installed web app's originp.52
- 53Security: Baseline hardening, security headers and staged policy rolloutp.53
- Web security rollout planp.53
- 54Security: XSS defenses, origin checks and third-party subresourcesp.54
- Sanitizing untrusted HTMLp.54
- Trusted Typesp.54
- Validating origins and sitesp.54
- Securing external subresourcesp.54
- 55Security: Network boundaries for outbound and local-network trafficp.55
- Restricting outbound connectionsp.55
- Local Network Accessp.55
- 56Security: Passkey foundations, registration and silent post-login creationp.56
- Passkeys orientationp.56
- Passkey registrationp.56
- Conditional create after password sign-inp.56
- 57Security: Passkey sign-in, quick sign-ins, reauthentication and managementp.57
- Passkey authenticationp.57
- Quick sign-ins with immediate UI modep.57
- Passkey reauthenticationp.57
- Passkey managementp.57
- 58Security: Client-side cryptography and passwordless email verificationp.58
- Client-side encryptionp.58
- Digital signaturesp.58
- Verifying email ownership without a codep.58
- 59Privacy: Privacy by design for web appsp.59
- Privacy guidelinesp.59
- 60JavaScript: Dates, times, time zones and calendars with Temporalp.60
- Location-agnostic dates, times and partial datesp.60
- Scheduling events in a geographic time zonep.60
- Elapsed and remaining time, and formatting durationsp.60
- Sorting nanosecond timestampsp.60
- Non-Gregorian calendar systemsp.60
- 61Built-in AI: Prompt API (on-device language model)p.61
- Prompt API (LanguageModel)p.61
- Dos and don'ts for every built-in AI APIp.61
- 62Built-in AI: Language detection, summarization and translationp.62
- Language Detector APIp.62
- Summarizer APIp.62
- Translator APIp.62
- 63WebMCP: Exposing page features as tools for AI agentsp.63
- WebMCP overview and design rulesp.63
- Declarative WebMCP: agentic formsp.63
- Imperative WebMCP: JavaScript toolsp.63
- 64WebAssembly: Compiling C and C++ with Emscriptenp.64
- C and C++ on the web with Emscriptenp.64
- 65Sources, license and upkeepp.65
- Sourcep.65
- Licensep.65
- Scopep.65
- Upkeepp.65



