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

State of CSS 2023

State of CSS 2023

Changes to the Web-Platform have picked up a lot of momentum over the last years. Browser Vendors are busy modernizing the CSS and providing long-overdue features to streamline the web and improve interoperability.

Instead of waiting for years to be able to adopt new features, evergreen browsers allow us to use the future already today.

We look at new CSS capabilities and see what we can use them for. Practical examples will help you understand how you can utilize the new features. We will talk about upcoming features that will come to a browser near you in a foreseeable time.

Avatar for Benjamin Kott

Benjamin Kott

August 04, 2023
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 https://web.dev/interop-2022 https://wpt.fyi/interop-2022
  3. .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; } }
  4. .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; } }
  5. HAS

  6. :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; }
  7. INTEROP 2023 Border Image in CSS Color Spaces and Functions

    in CSS Container Queries in CSS Containment in CSS CSS Pseudo-classes Custom Properties in CSS Flexbox Font Feature Detection and Palettes Forms Grid :has() Inert Masking in CSS Math Functions in CSS Media Queries 4 Modules in Web Workers Motion Path in CSS Animations Offscreen Canvas Pointer and Mouse Events Scrolling Subgrid Transforms URL Web Compat 2023 Web Codecs (video) Web Components https://web.dev/interop-2023 https://wpt.fyi/interop-2023
  8. .button { display: inline-block; outline: 0; border: 1px solid white;

    } .button:focus { border-color: red; } .button:focus-visible { outline: 1px solid green; }
  9. @property --color { syntax: '<color>'; initial-value: #000000; inherits: false; }

    @property --space { syntax: '<length>'; initial-value: 0; inherits: false; }
  10. @keyframes pulse { 0% { --color: #ecd803; --space: 20px; }

    80% { --color: #ec8603; --space: 10px; } 100% { --color: #ecd803; --space: 20px; } }
  11. text-wrap: normal Lorem ipsum dolor sit amet, consectetur adipiscing elit.

    text-wrap: balance Lorem ipsum dolor sit amet, consectetur adipiscing elit.
  12. srgb Standard RGB srgb-linear Standard RGB Linear hsl Hue, Saturation,

    Lightness hwb Hue, Whiteness, Blackness lch Hue, Chroma, Luminance oklch Uniform Hue, Chroma, Luminance lab Perceptual lightness, Chroma, Hue oklab Uniform Perceptual lightness, Chroma, Hue
  13. srgb Standard RGB srgb-linear Standard RGB Linear hsl Hue, Saturation,

    Lightness hwb Hue, Whiteness, Blackness lch Hue, Chroma, Luminance oklch Uniform Hue, Chroma, Luminance lab Perceptual lightness, Chroma, Hue oklab Uniform Perceptual lightness, Chroma, Hue
  14. srgb Standard RGB srgb-linear Standard RGB Linear hsl Hue, Saturation,

    Lightness hwb Hue, Whiteness, Blackness lch Hue, Chroma, Luminance oklch Uniform Hue, Chroma, Luminance lab Perceptual lightness, Chroma, Hue oklab Uniform Perceptual lightness, Chroma, Hue 100% 100% 98% 90% 85% 85% 85% 85%
  15. No animals were harmed in this photo shoot except for

    the last unicorn. Will not happen again, rest in peace.
  16. :root { --text-color-1-value: yellow; --text-color-1-percent: 50%; --text-color-2-value: cyan; --text-color-2-percent: 50%;

    } .block { background: color-mix( in srgb, var(--text-color-1-value) var(--text-color-1-percent), var(--text-color-2-value) var(--text-color-2-percent) ); }
  17. .nesting > .is > .awesome { color: deeppink; } .nesting

    { > .is { > .awesome { color: deeppink; } } }
  18. .demo .triangle, .demo .square { opacity: .25; filter: blur(25px); }

    /* grouped with :is() */ .demo :is(.triangle, .square) { opacity: .25; filter: blur(25px); }