liveBook · Manning

Progressive enhancement

As explained in CSS in Depth, Second Edition

A web development technique that introduces newer capabilities while allowing unsupported browsers to ignore them without preventing the rest of the stylesheet from applying.

Progressive enhancement layers newer CSS capabilities onto a usable baseline. Older browsers ignore unsupported declarations or rules while continuing to parse the rest of the stylesheet; newer browsers receive the fuller experience. section 1.5 section 1.5.1

Apply the technique by building from a dependable baseline:

  • Define an acceptable experience with widely supported CSS. section 1.5
  • Layer a newer declaration afterward when the cascade can safely select it. section 1.5.1
  • Separate selectors when one unsupported selector would invalidate an entire ruleset. section 1.5.2
  • Use @supports when conditional application is clearer or when several declarations must change together. section 1.5.3

A transparent background with a fallback

Set a solid color first, then add the newer eight-digit hexadecimal form: the older browser keeps the solid color, while a supporting browser uses transparency. The page remains usable in both cases. section 1.5.1

Listing 1.25 Using a feature query for progressive enhancement
.coffees {
  margin: 20px 0;
}

.coffees a {
  display: inline-block;    #1
  min-width: 300px;         #1
  padding: 10px 15px;
  margin-right: 10px;
  margin-bottom: 10px;
  color: black;
  background-color: transparent;
  border: 1px solid gray;
  border-radius: 5px;
}

@supports (display: grid) {     #2
  .coffees {
    display: grid;                          #3
    grid-template-columns: 1fr 1fr 1fr;     #3
    gap: 10px;                              #3
  }

  .coffees a {
    margin: unset;       #4
    min-width: unset;    #4
  }
}

A coffee-link layout starts with inline-block cards, then switches to a three-column grid and removes conflicting margins when the browser supports display: grid. section 1.5.3

How CSS in Depth, Second Edition covers it

How deep it goes
Explains declaration, selector, and feature-query strategies with concrete layouts, while leaving feature-specific CSS details to other topics.
Examples
Uses transparent background colors, validation selectors, and a coffee-link layout enhanced from inline-block cards to CSS Grid.
What it assumes
Assumes familiarity with CSS declarations and selectors while teaching browser fallback behavior from the cascade upward.
What you can do after
Apply it by pairing dependable CSS with newer declarations, selectors, or layouts that browsers can adopt selectively.
How it connects
Connects the CSS cascade, selectors, feature queries, browser compatibility, and resilience.

Also explained in

Compare how 2 books explain progressive enhancement →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of CSS in Depth, Second Edition. The section links point to the parts of the book it draws on.