THE GITHTML FIELD GUIDE
Keep a document readable when a CSS feature is unsupported
Provide a simple readable baseline before using a newer CSS feature, and place optional enhancements behind @supports when appropriate. A feature query checks support for syntax, not whether the complete design works well. Verify the fallback by removing the enhancement rather than assuming an unsupported declaration will always leave the page usable.
Identify the specific failure
A layout can fail because the author supplied only the enhanced version. Ignoring an unfamiliar declaration is normal browser behavior, but surrounding fixed sizes or hidden content may still make the remaining layout unusable.
Make a narrow correction
Start with ordinary document flow and visible content. Add the enhancement in a narrow rule that does not erase essential information. Avoid hiding the baseline solely because a syntax test succeeds; successful parsing does not guarantee the desired behavior in every context.
- Build a complete readable baseline before introducing the optional feature.
- Use feature queries for enhancement boundaries, not as a replacement for testing.
- Disable the enhancement and confirm that all essential content remains available.
.cards { display: block; }
@supports (display: grid) { .cards { display: grid; gap: 1rem; } }Test failure by removing the enhancement, not the content
Consider a set of three report cards arranged with a newer layout feature. The cards should first exist as a sensible vertical sequence, each with its heading and explanation. If the feature is unavailable, that sequence is the reading experience. An empty container with instructions to wait for the enhanced layout is not a fallback. Test by temporarily removing the enhancement rule while keeping all the content and baseline styles; this makes the expected unsupported path visible without needing to locate an old device immediately.
A feature query answers whether the browser accepts the tested feature, not whether every surrounding combination is sound. A rule can parse successfully while a fixed height clips its content or an unrelated selector never matches. Keep the query narrow and inspect the applied declarations. If an enhancement changes alignment, avoid coupling it to content visibility unless there is a fully tested reason. Readers should not lose a warning because a typography or layout check happened to return true.
Fallbacks also need maintenance after content grows. An initially short title may become several lines, and a translated label may be much longer than the original. Add one deliberately difficult card to the test fixture and compare the plain and enhanced paths. Both should preserve order, links, and complete text, although spacing may differ. When the advanced treatment has no meaningful benefit for reading, omitting it can be an appropriate final choice rather than building a complicated compatibility branch solely to reproduce a decorative screenshot.
Verify the repaired artifact
Compare both branches with the same long content and enlarged text. The fallback may be simpler, but it should answer the same reading question.
Sources and further reading
AI-assisted writing with source-linked guidance and illustrative examples. Read our editorial approach or report a correction.