back to module

Smashing Workshops

Modern & Resilient

Arrows navigate, cmd/ctrl-k for settings

New Features!

The random() Function is Cool!

Does random() Have Support??

Hand written note says I like you, do you like me?
Mixed-support screenshot from CanIUse showing some full, some partial, and some missing support - the feature details are scribbled out and instead it says artist rendering
X's, checks, and question marks scribbled all over the note in random red and green variations
70.35% Partial???

Browser Support is Not A Binary

Arbitrary Cutoff? 95% ? 100% ? Last Two ?

Features with 100% browser support _are capped at 97.98%_
Change your CanIUse settings [Features with 100% browser support are capped at 97.98%]

Support stats Are Updated Manually

Usage stats Vary Widely

Browser usage table

Which browsers are counted?

Baseline
Baseline

⚠️ Warning A11y Support Not Included (yet)

Adrian Roselli, Baseline Does Not Really Cover Baseline Support

Mozilla Developer Network

More detailed breakdown

Web Platform Tests

File and Follow Browser Issues

How do we do… Progressive Enhancement?

Responsive Web Design
2010 [Ethan Marcotte, Responsive Web Design]

Responsive ➡ Resilient

Meme format with astronauts looking at earth, now with the Line Mode browser overlaid. Front astronaut says Wait, it's all progressive enhancement? and the second with a gun says Always has been.

Not Re-Writing For Every Viewport

Viewport Sizes: permalink
avatar

If you have to entirely re-engineer for IE… you’re Doing It Wrong.

— Natalie Downe, CSS Systems
2008

Consider… Features Not Browsers

Re-Define What ‘Support’ Means

Not identical, but equivalent

avatar

There is a difference between support and optimization.

— Brad Frost, support vs optimization
Headshot of Jeremy Keith.
  1. Identify core functionality.
  2. Make that functionality available using the simplest possible technology.
  3. Enhance!
— Jeremy Keith, Resilient Web Design

This is… Progressive Enhancement

Testing fallbacks… Comment Out The Code

Headshot of Jen Simmons, smiling

You can use it and not use it at the same time, because it works and it doesn’t work at the same time. It’s Quantum CSS! It’s Magic!

— Jen Simmons, Intro to Resilient CSS
Headshot of Jen Simmons, smiling

Jen Simmons Resilient Videos

Some issues… No Fallback Needed

No Fallback?: present, debug
Getting started with View Transitions
Dave Rupert, Getting started with View Transitions

Some issues… ‘Silent’ Fallback

Order of Appearance

And parse-time validation

  • We can use this parse-time (syntax) validation
  • Along with order-of-appearance
  • To silently fall back from one value to another
css
h2 {
  color: green;

  /* discarded by old browsers before cascade */
  /* wins cascade when read as valid syntax */
  color: oklch(0deg 50% 50%);
}
  • We can use a well-supported value
  • And then provide a second declaration with something new
  • Old browsers will discard the new syntax as invalid at parse time
  • (when filtering declarations)
  • But new browsers will keep both values around in the cascade
  • And the second one will win
  • So order doesn’t matter for old browsers,
  • But it does matter for newer browsers
Subgrid Form: present, debug
Silent fallback: present, debug
Invalid At Computed Value Time: present, debug
  • We talked about this some,
  • But I want to go into it a bit more
  • Because this Invalid At Computed Value Time behavior
  • Is becoming more and more common in CSS
css
.ಠ_ಠ {
  --(╯°□°)╯: ︵┻━┻;
}
“… is valid CSS.” --Tab Atkins (on Twitter, years ago)
ಠ_ಠ Valid Table-Flip : present, debug
  • It doesn’t do anything
  • Unless we make it do something
css
.ಠ_ಠ {
  --(╯°□°)╯: ︵┻━┻;
}
✅ Valid
  • According to CSS syntax rules
  • Valid to define

Syntactically Valid

(otherwise discarded at parse-time)

  • Declarations must be syntactically valid
  • But what’s that mean?
css
.ಠ_ಠ {
  --(╯°□°)╯: ︵┻━┻;
  color: var(--(╯°□°)╯);
}
🤔 Valid?
  • Valid to access on (say) color prop
css
.ಠ_ಠ {
  color: ︵┻━┻;
}
❌ Valid
  • Only becomes invalid
  • After we replace the variable
  • Color property requires color syntax

var() output… Not Validated
Until Applied

  • Parse-time validation early, before cascade
  • We don’t know cascaded value

Variable substitution After Cascade is Complete

  • Var substitution has to wait
  • Go by syntax alone
css
.ಠ_ಠ {
  --(╯°□°)╯: ︵┻━┻;
  color: var(--(╯°□°)╯);
}
✅ Valid (but will fail later)
  • Valid, but will fail later
  • Will fail after the cascade
  • Which is a problem…

Support Queries

MDN, Support Queries
Wide Gamut Colors (v2): present, debug

Selector Queries

MDN, Selector Queries
Selector Fallback :has(): present, debug

:is() and :where() Are Forgiving Selector Lists

But Not Nesting

Forgiving Selector Lists: present, debug

Preference Queries

MDN, Preference Queries

@media Not Just Print & Viewport Sizes

prefers-color-scheme

light | dark | no-preference

prefers-contrast

low | high | no-preference

prefers-reduced-motion

reduce | no-preference

prefers-reduced-transparency

reduce | no-preference

The real advance in accessibility, is providing options and adapting to user preferences.

— Kate Kalcevich
  • Adapting to preferences isn’t just a fun way
  • to play with interactions (but it is fun!)
  • Providing options is central to accessibility
avatar

While the author (or publisher) often wants to give the documents a distinct look and feel, the user will set preferences to make all documents appear more similar.

— Håkon Lie, Cascading HTML style sheets – a proposal (Oct 1994)
  • And CSS was designed for it, from the start!
We're Not Alone, with browser logos, a guy in construction clothes carrying a laptop, and ET
  • It’s the whole reason we’re here today

People don’t think of themselves as disabled, so they don’t think the accessibility preference area applies to them.

— Eric W Bailey, Accessibility preference settings, information architecture, and internalized ableism
  • All of us use the web
  • And all of us have preferences
  • And a web that respects us people
  • Is a more usable web for everyone
Media Prefers…: present, debug
No Motion Isn’t Always `prefers-reduced-motion`
No Motion Isn’t Always prefers-reduced-motion
Reduced Motion: present, debug

Media Features

MDN, Media Features
css
@media (hover: none) { }
@media (pointer: coarse) { }

How do you sell this… To The Boss or Client?

We Don’t

It’s just the job we do

The web Is For People

Those people Rely On Our Services

Our job is Making The Web Usable

We don’t Optimize For Every Situation

We do try to Support Everyone

The details Vary Across Projects

Sort issues By Impact Priority

Content should be viewable and accessible by default.

— W3C, Platform Design Principles
  • another design principle of the w3c
  • content should be viewable and accessible by default
Headshot of Jeremy Keith.
  1. Identify core functionality.
  2. Make that functionality available using the simplest possible technology.
  3. Enhance!
— Jeremy Keith, Resilient Web Design

Care about people Over Design Purity

First Do No Harm

  • This is our job as designers (engineers)
  • everything else we do in this workshop
  • everything else in CSS
  • built around this political vision
  • protect the content, protect the user
  • First, Do no harm
SlideDeck Controls

View

Keyboard shortcuts
cmd/ctrl-k:
Toggle this control dialog
cmd/ctrl-shift-enter:
presentation (from first slide)
cmd/ctrl-enter:
presentation (from active slide)
alt-enter:
in speaker view (following active slide)

Color Settings