{"canonical_url":"https://engineer.company/glossary/progressive-enhancement/","content_markdown":"# Progressive enhancement\n\n## What it is\n\nProgressive enhancement is a way of building web pages in layers, starting from\nthe one that always works. The base is HTML that carries all of the content and\ncompletes every task on its own: links lead somewhere, forms submit to a server,\nand the page can be read and used with nothing else loaded. Style sheets go on\ntop to lay the page out and make it pleasant to look at. Scripts come last, to\nmake it quicker or smoother to use. Each layer improves the one beneath it, and\nthe page does not depend on any layer above the HTML to do its job. The GOV.UK\nService Manual sums the idea up as making a page work with HTML first.\n\nThe name comes from a talk by Steven Champeon and Nick Finck, *Inclusive Web\nDesign For the Future with Progressive Enhancement*, which their paper says was\ndelivered on 11 March 2003 at SXSW in Austin, Texas. The paper writes it with\ncapitals, Progressive Enhancement, and shortens it to PE. It sets the idea\nagainst graceful degradation, the older habit of building for the most capable\nbrowser and hoping that the others could still get at the content. PE, as the\npaper describes it, starts with a document that the least capable devices can\nuse, then adds presentation as separate logic, so that the basic devices are not\nweighed down by what the modern browsers get.\n\nThe difference between the two is the direction of the work. Graceful\ndegradation starts from the full experience and asks what is left when parts of\nit are missing. Progressive enhancement starts from what is always there and\nasks what can be added. In a current browser on a good connection both can end\nat the same page. They differ when something fails: a page built from the\nbaseline up still has its baseline, and a page built from the top down has\nwhatever its authors remembered to provide.\n\nIt is a way of working, not a library or a feature. Nothing in HTML, CSS or\nJavaScript is called progressive enhancement, but the standards leave room for\nit. A browser skips a CSS declaration it does not understand and ignores a\nscript whose type it does not recognise, and the `@supports` rule lets a style\nsheet ask whether a feature is there before relying on it.\n\n## Why it matters\n\nThe layers fail in different ways, and the GOV.UK Service Manual spells out how.\nThe CSS layer is reasonably forgiving: a browser skips a declaration it does not\nrecognise and carries on, although a selector it does not know makes it drop the\nwhole rule. The JavaScript layer is not forgiving at all. When a script uses\nsyntax or an interface the browser lacks, the rest of that script does not run.\nA page that needs its script for its main task is therefore only as reliable as\nevery step between the server and the reader.\n\nThere are a lot of those steps. The same page lists what can stop the CSS or the\nJavaScript from loading or running: a temporary network error, an ad blocker, a\ncontent delivery network that is down, a DNS failure, a bug in a browser update,\na corporate or a personal firewall. None of them has anything to do with an old\nbrowser, and the reader cannot tell which one it was. They see a button that\ndoes nothing. The manual gives no figures for how often each one happens; its\nargument rests on the list, not on a percentage.\n\nSome readers also switch things off on purpose. The manual says that some users\ndeliberately turn off features in their browsers and that their choice should be\nrespected. The HTML Standard says that many users disable scripting, and for\nthat reason, and because declarative features are often easier to maintain, it\nencourages authors to use them in place of script where they can. Its example is\nthe `details` element, which shows and hides a section of a page without a line\nof JavaScript. The standard also asks authors to make their applications degrade\ngracefully when there is no scripting support.\n\nFor UK government services the manual turns this into a rule: they should be\nfunctional using only HTML, and JavaScript, where it is used, should only\nenhance the HTML and CSS so that people can still use the service when the\nscript fails. That rule is written for one government's services, not for the\nwhole web, but its reasoning carries over to any site whose readers its authors\ncannot choose.\n\nThere is a gain for the team as well. When an enhancement breaks, the reader\nloses the improvement, not the task, so a fault in a script is an annoyance\nrather than an outage. A new feature can be shipped to the browsers that support\nit without a plan for the ones that do not, because those keep the page they\nalready had.\n\n## What it looks like in practice\n\nThe HTML Standard's own example of graceful behaviour without script is a table\nwhose column headings re-sort it, and it is a fair test of the approach. The\nbaseline is a table whose headings are ordinary links. A click asks the server\nfor the same table sorted by that column, and the server sends it back in that\norder. This works in any browser, with or without a script.\n\n```html\n\u003ctable id=\"orders\"\u003e\n  \u003cthead\u003e\n    \u003ctr\u003e\n      \u003cth\u003e\u003ca href=\"?sort=date\"\u003eDate\u003c/a\u003e\u003c/th\u003e\n      \u003cth\u003e\u003ca href=\"?sort=total\"\u003eTotal\u003c/a\u003e\u003c/th\u003e\n    \u003c/tr\u003e\n  \u003c/thead\u003e\n  \u003ctbody\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e2026-10-20\u003c/td\u003e\n      \u003ctd\u003e120\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e2026-10-24\u003c/td\u003e\n      \u003ctd\u003e45\u003c/td\u003e\n    \u003c/tr\u003e\n  \u003c/tbody\u003e\n\u003c/table\u003e\n\u003cscript type=\"module\" src=\"sort.mjs\"\u003e\u003c/script\u003e\n```\n\nThe script is the enhancement. It finds the same links, cancels the navigation\nand reorders the rows in the page, which saves a round trip to the server.\n\n```js\nconst table = document.querySelector(\"#orders\");\nconst body = table.tBodies[0];\nconst collator = new Intl.Collator(\"en\", { numeric: true });\n\nfunction sortBy(column) {\n  const text = (row) =\u003e row.cells[column].textContent;\n  const rows = [...body.rows];\n  rows.sort((a, b) =\u003e collator.compare(text(a), text(b)));\n  body.append(...rows);\n}\n\nfor (const link of table.tHead.querySelectorAll(\"a\")) {\n  link.addEventListener(\"click\", (event) =\u003e {\n    event.preventDefault();\n    sortBy(link.closest(\"th\").cellIndex);\n  });\n}\n```\n\nFailures before a listener is attached leave that link working. If `sort.mjs` never arrives,\nthe links do what they did before. If the script throws halfway, the headings\nwhose listeners it never reached fall back to the server. A browser that does\nnot support module scripts treats `type=\"module\"` as a script type it does not\nknow and, as the HTML Standard says, ignores it. A module script without `async`\nis run once the page has finished parsing, so the table is there by the time the\nscript looks for it.\nThis example does not recover if an attached click handler throws after\n`preventDefault()` has cancelled navigation.\n\nThe price is on the server: the baseline needs an endpoint that can sort, and\nthe two ways of sorting have to agree. That is the usual cost of the approach,\npaid once. The intended benefit is a page whose main task remains usable through\nthe server fallback; an attached handler must preserve that fallback when its\nown work fails.\n\nThis site makes its baseline explicit. [Its accessibility statement](/accessibility/)\ndescribes complete HTML, CSS and SVG pages with no executable JavaScript. The search\ncode is retained but disabled, so there is no in-page filter to depend on. The statement\nalso names a remaining limit: the small labels shown on icon hover or focus cannot be\ndismissed with a key, which would need browser code the site does not ship. That is why\nit meets 1.4.13 Content on Hover or Focus only in part.\n\n## Where it goes wrong\n\n**A `noscript` block stands in for a baseline.** The `noscript` element shows\nits content only when scripting is disabled, and the HTML Standard is blunt\nabout it: “The noscript element is a blunt instrument.” Scripting can be enabled\nand the page's script can still fail, and then the reader gets neither the\nscripted page nor the fallback. Start from a page that works without the script\nand let the script change it, as the standard's own example does when its script\nadds a live result to a form and removes the form's submit button.\n\n**One unsupported feature stops the whole script.** Because the JavaScript layer\nis not fault-tolerant, a single newer piece of syntax in a bundle can take every\nenhancement in that bundle down with it, including those that would have worked.\nKeep the baseline independent of the script, so that a failure costs the\nenhancement and nothing else. Load modern code with `type=\"module\"`, which older\nbrowsers skip, and if older browsers need an enhanced version at all, give them\na separate classic bundle marked `nomodule`, which browsers that support modules\ndo not run.\n\n**A new selector takes good rules down with it.** A browser that meets a\nselector it does not know drops the entire rule, declarations and all. Listing a\nrecent pseudo-class next to selectors that every browser understands can\ntherefore remove styles from browsers that would have applied them. Give a\nselector that some browsers may not support a rule of its own.\n\n**Fallback styles leak into the enhanced layout.** Widths written for browsers\nwithout a newer layout system can fight that layout system in the browsers that\nhave it. CSS Conditional Rules Level 3 shows the fix with a flex layout and an\n`@supports not (display: flex)` block for the alternative, and notes that the\nwidth declarations could harm the flex layout, which is why they belong only in\nthe styles for browsers without it.\n\n**Images are chosen by script.** The HTML Standard points out that if a page\nnames no image in its markup and leaves the choice to a script, no image is\ndownloaded at all for readers with scripting disabled, and if a script replaces\nan image the markup already named, the browser may start two downloads. Declare\nthe candidates in HTML with `srcset` and `sizes`, or with `picture`, and let the\nbrowser choose.\n\n**Behaviour with nothing underneath.** Champeon and Finck's strategy list asks\nfor a fallback for all behaviour: a real `href` behind every click handler, and\na check on the server behind every check in the browser. A control that exists\nonly as a click handler, or a form that is validated only in the browser, has no\nbaseline at all. Use real links and real form submissions first, always validate\non the server, and treat validation in the browser as a convenience added on\ntop.\n\n**Treating it as a matter of old browsers.** A team that thinks the baseline is\nfor old browsers drops it once those browsers are gone. The GOV.UK list of\ncauses is about networks, blockers, firewalls and broken updates, which current\nbrowsers meet as well. Keep the baseline as a path that is used and tested: load\nthe page with scripts blocked now and then, and carry out its main task from\nstart to finish.\n\n## Further reading\n\n- [Using progressive enhancement](https://www.gov.uk/service-manual/technology/using-progressive-enhancement)\n  — the GOV.UK Service Manual's guidance, last updated 27 September 2024: the\n  three layers, how each one fails, and why government services should work with\n  HTML alone.\n- [HTML Standard: Scripting](https://html.spec.whatwg.org/multipage/scripting.html)\n  — the `script` element with `type=\"module\"` and `nomodule`, and the `noscript`\n  element with the advice against relying on it.\n- [CSS Conditional Rules Module Level 3](https://www.w3.org/TR/css-conditional-3/)\n  — the W3C Candidate Recommendation Draft of 15 August 2024 that defines\n  `@supports` with its `not`, `and` and `or`.\n- [HTML Standard: Images](https://html.spec.whatwg.org/multipage/images.html)\n  — `srcset`, `sizes` and `picture`, and why choosing an image with script fails\n  readers who have scripting turned off.\n\n\u003chttps://engineer.company/glossary/progressive-enhancement/\u003e\n","date_modified":"2026-11-09T21:50:25Z","description":"Why a page should work in plain HTML before style and script are added: where the idea came from, how each layer fails, a worked example and the traps.","formats":{"gemtext":"https://engineer.company/glossary/progressive-enhancement/index.gmi","gopher":"https://engineer.company/glossary/progressive-enhancement/gophermap","html":"https://engineer.company/glossary/progressive-enhancement/","json":"https://engineer.company/glossary/progressive-enhancement/index.json","markdown":"https://engineer.company/glossary/progressive-enhancement/index.md","pdf":"https://engineer.company/glossary/progressive-enhancement/index.pdf"},"kind":"page","language":"en","title":"What is progressive enhancement?","url":"https://engineer.company/glossary/progressive-enhancement/","version":1}