Upgrade to Pro — share decks privately, control downloads, hide ads and more …

State of CSS 2022

State of CSS 2022

Browser interoperability of CSS features was always a problem in the past. But that started to change when browser vendors started to agree on focus areas, enough to be hyped about it.

The CSS landscape is now rapidly changing, CSS variables, grids, flexbox and transforms are stable and production ready for a while now. While the features are nice, the potential shines when you start combining them.

We will have a look at legacy CSS components and see how we can improve them with modern CSS features. Answer the question if CSS pre-processing is still a thing and we will talk about upcoming CSS features and evaluate the impact.

Avatar for Benjamin Kott

Benjamin Kott

August 12, 2022
Tweet

More Decks by Benjamin Kott

Other Decks in Programming

Transcript

  1. 2019 / 2020 Web Developer Needs Assessment Web DNA Report

    https://insights.developer.mozilla.org/
  2. INTEROP 2022 Cascade Layers Color Spaces and Functions Containment Dialog

    Element Forms Scrolling Subgrid Typography and Encodings Viewport Units Web Compat
  3. @media (prefers-color-scheme: dark) { :root { --vcard-color: #fafafa; --vcard-bg: #313131;

    --vcard-highlight-color: #9ccc65; --vcard-highlight-bg: #7cb342; } }
  4. @layer layout, theme, override; @layer theme { :root { --vcard-highlight-bg:

    #03a9f4; } } @layer override { :root { --vcard-highlight-bg: #9c27b0; } } @layer layout { :root { --vcard-highlight-bg: #8bc34a; } }
  5. .vcard { container-type: inline-size; } @container (min-width: 250px) { .vcard-container

    { --vcard-name-font-size: 1.2rem; } } @container (min-width: 500px) { .vcard-container { --vcard-name-font-size: 1.5rem; } }
  6. .vcard { container-type: inline-size; container-name: vcard } @container vcard (min-width:

    250px) { .vcard-container { --vcard-name-font-size: 1.2rem; } } @container vcard (min-width: 500px) { .vcard-container { --vcard-name-font-size: 1.5rem; } }
  7. .vcard-container { display: grid; grid-template: 'vcard-image' 100px 'vcard-body' ; }

    .vcard-image { grid-area: vcard-image; .vcard-body { grid-area: vcard-body; }
  8. HAS

  9. :root { --article-color: #313131; --article-bg: #fff; } .article { color:

    var(--article-color); background: var(--article-bg); } .article:has(.article-image) { --article-color: #fff; --article-bg: #9c27b0; }