Modern Web Guidance
Chrome, Edge, Firefox and MDN now ship a skill that steers coding agents toward modern CSS and away from old patterns. Here's what it covers and where modern.css fits next to it.
What Modern Web Guidance is
Coding agents write a lot of old CSS, and the reason isn't a mystery: most of the code they learned from was written before :has(), container queries or light-dark() existed. Ask one for an accordion and you'll often get a max-height: 9999px transition, ask for a dark theme and you'll get a second copy of every color inside a media query. Modern Web Guidance is Google's attempt to fix that by putting modern CSS, HTML and JavaScript guidance into the agent's context at the moment it's writing code. It's a skill you install into your coding agent, plus a small command-line tool the agent calls when it's working on web code.
The Chrome team announced version 1 in November 2026. The project's README says it's looked after by the Chrome, Edge, Firefox and MDN teams together, which matters for anyone worried about a Chrome-only view of the web. The code is Apache 2.0 and the guides are CC BY 4.0, so anyone can read, reuse and build on them.
How an agent uses it
The skill itself is tiny. It tells the agent to search the guides when a task touches the web platform, and the agent does that with two commands you can also run yourself:
npx modern-web-guidance@latest search "animate a dialog modal backdrop"
npx modern-web-guidance@latest retrieve "animate-to-from-top-layer"Search runs offline on your machine, using a keyword index and a small built-in embedding model, and returns guide ids. Retrieve prints one guide into the agent's context: the code pattern, the gotchas and the fallback for browsers that don't have the feature yet. The guides use Baseline data from the web-features project, so the agent knows whether a feature is safe everywhere or needs a fallback.
New features that only one browser engine shipped in the last three months are treated as volatile. They show up in search, but retrieve holds them back unless the project opts in through a .mwgrc file. That's a sensible default, because an agent that reaches for a Chrome-only feature on a site that needs Safari creates work instead of saving it.
There's also a scanner for existing code, npx modern-web-guidance@latest legacy-scan ., which looks through a project for old patterns and points the agent at the guide that replaces each one.
What AI gets wrong in modern CSS
The same week, the Chrome team published the top 10 things AI gets wrong in web development. Eight of the ten are about accessibility, user experience and performance, and most of those come down to modern CSS that the agent either didn't know or didn't reach for.
A few of the CSS ones stood out to us, because they're the same patterns we see in real stylesheets:
- Forms. Agents re-implement
:user-invalidwith custom JavaScriptblurvalidation, or style:user-invalidwithout keepingaria-invalidin sync for screen readers. - Dialogs and popovers. They build
position: fixedoverlays with their own click-outside handlers instead of using the top layer, and animate them with JavaScript instead of@starting-styleandtransition-behavior. - Dark mode. They forget
color-scheme, which leaves native scrollbars and form controls stuck in light mode, and overlooklight-dark()for theme colors. - Long pages. They build dense layouts like data grids without
content-visibility: autoandcontain-intrinsic-size, and hide inactive views withdisplay: nonewherecontent-visibility: hiddenwould do the job. - Layout shifts. They size wrapper elements instead of putting
aspect-ratioandobject-fiton the image itself, pair web fonts with fallbacks withoutfont-size-adjust, and use staticvhunits wheredvhorsvhwould stop the jump on phones. - Swipe interfaces. They leave out
overscroll-behavior-x: noneon tab-swipe interfaces.
None of this is exotic. Most of these features are Baseline already, and several have been for years. The gap is that an agent's training data still has far more of the old version than the new one.
Fallbacks and your Baseline target
Modern CSS is only useful if it works in the browsers your visitors use, and the guides take that seriously. Google's post on cross-browser by default says the guidance treats Baseline Widely available features as safe to use without fallbacks. Anything newer gets one of four kinds of fallback:
- No fallback code at all, for decorative features that older browsers just ignore.
text-wrap: balanceis the example: without it, headings wrap the old way and nothing breaks. - An
@supportsblock, for layout or visual styles that would look broken if only half applied. The post's example wraps a tooltip arrow in@supports (container-type: anchored). - A small script, for HTML attributes and APIs that need a few lines of JavaScript to behave the same in older browsers, like closing a
<dialog>on a backdrop click whenclosedbyisn't supported. - A polyfill loaded only when needed, for bigger features. For CSS anchor positioning the guide checks
CSS.supports('anchor-name: --a')and only imports the polyfill when that's false, so browsers that support it download nothing extra.
Teams can set their own line in AGENTS.md or CLAUDE.md. The post's example is a single sentence, "Target Baseline 2024 or earlier", and the agent then treats anything that became Baseline later as needing a fallback. Google reports that agents passed its fallback checks 43% of the time without the guidance and 87% with it.
How the legacy scanner works
The part that overlaps most with what we do is legacy-scan. The modernization workflow describes it in four steps:
- Scan. The agent runs
legacy-scan, which reads HTML, CSS, JavaScript and TypeScript, framework components andpackage.jsonwith real parsers. It runs locally with no AI calls, and it only parses files that contain something worth checking. - Verify. Every match comes with a keep-when and drop-when rubric, and the agent, which can see the rest of the code, drops the matches that turn out to be fine.
- Report. The agent summarizes what's left.
- Fix and re-check. The agent retrieves the guide for each finding, makes the change, then runs the scan and the project's tests again.
Google tuned the rules on about 45,000 open-source repositories, using half to write the rules and the other half to grade them. A rule only ships by default when at least 80% of its raw matches are real, and at least 90% after the agent's check. That's a high bar, and it's why the scanner only covers part of the guide catalog.
The CSS examples in the workflow are familiar ones: max-height: 9999px accordions become interpolate-size and calc-size(), JavaScript that toggles a class on a parent becomes :has(), and duplicated prefers-color-scheme blocks become light-dark(). The textarea one is a good picture of what modern CSS replaces:
textarea {
field-sizing: content;
min-block-size: 3lh;
max-block-size: 15lh;
}That's the whole thing, in place of a script that listens for input and copies scrollHeight into the height. We cover the same change in auto-growing textarea without JavaScript.
How much modern CSS it covers
The README lists 250 web features, and 140 of them are in its CSS and layout group. The guides themselves are organized by task rather than by property, with names like style-parent-with-has, size-aware-styling, animate-to-intrinsic-sizes and validate-input-after-interaction. That fits how an agent works: it starts from "make this form show errors" and needs to land on :user-invalid, not the other way round.
Google publishes its own test results. On the README's 8 November run, Claude Code passed 57% of its checks without the guides and 88% with them, across 215 tasks. Those are Google's numbers on Google's test apps, but the full breakdown is public on the eval dashboard.
One thing to know before installing it: telemetry is on by default. The README says it collects install counts, the agent's name, the guide ids it retrieves and the search queries the agent writes, but not your prompts. Setting DISABLE_TELEMETRY=1 in your shell profile turns it off.
Where modern.css fits
We've been building modern.css around the same idea for a while: every old CSS habit has a modern CSS replacement, and the replacement should come with honest browser support. Modern Web Guidance overlaps with that, so it's worth being clear about what each one is for.
Modern Web Guidance is written for agents. Its guides are short on purpose, tuned to use as few tokens as possible, and you mostly see them through your agent's work. modern.css is written for people: each snippet shows the old way and the modern way side by side with a live demo, and the browser support table lists the first version of every feature in each browser.
The two audits differ in the same way. legacy-scan hands its findings to an agent to fix. The CSS audit runs in your browser without uploading your files, gives the project a modernity score, checks each fix against your Baseline target and keeps a record of runs so you can see the count go down. It now has three new checks taken from Google's material: max-height accordions, :invalid styles that show up before anyone has typed, and content-visibility: auto without a reserved size.
Using the two together
Each finding in the CSS audit now has a Copy a prompt for your AI agent button. The prompt lists the matching lines with file names and line numbers, names the modern fix, says when the old code is still the right call and links the snippet that explains it. When a Modern Web Guidance guide covers the same fix, the prompt includes the retrieve command for it, so an agent with the skill installed reads Google's guide before it starts editing.
Here's what it copies for the :invalid check:
Modernize this pattern in my code: :invalid styles that show before anyone types.
- src/form.css:12 `input:invalid`
Replace it with :user-invalid, one match at a time. When to leave one as it is:
Keep :invalid where showing the state straight away is the point, such as
disabling a submit button with form:invalid.
How the modern version works: https://modern-css.com/form-validation-styles-without-javascript/
If Modern Web Guidance is installed, read its guide first:
npx modern-web-guidance@latest retrieve validate-input-after-interactionThe audit finds the old code and tracks it over time, the agent makes the edits, and the guide keeps the agent from swapping one old pattern for a feature your users' browsers don't have yet.
Related comparisons
- Form validation styles without JavaScriptSelectors
- Auto-growing textarea without JavaScriptLayout
- Dark mode colors without duplicating valuesColors
- Lazy rendering without IntersectionObserverWorkflow
- Expand and collapse with grid instead of max-heightAnimation
- Selecting parent elements without JavaScriptSelectors