slides.oddbird.net/workshops/23-smashing-de/6-resilient/

Resilient Styles

@ Smashing Conf Freiburg

ReferenceError Variable is not defined

SyntaxError Missing } after property list

  @what about (this: fake code I) {
made-up :: that's not valid at all?
}

html {
background: rebeccapurple;
beep: boop;
color: white;
color: color(display-p3 0.9975 0.7295 0.8147);
color: fake;
}

The Primary Feature Of CSS The Entire Web

Web for all. Web on everything.

– World Wide Web Consortium, 1994

Arbitrary Cutoff 95% ? 100% ? Last Two ?

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

But Building Progressive Enhancements

2004…

/* IE6 and below */
* html #uno { color: red }

/* IE7 */
*:first-child+html #dos { color: red }

/* IE7, FF, Saf, Opera */
html>body #tres { color: red }

/* IE8, FF, Saf, Opera (Everything but IE 6,7) */
html>/**/body #cuatro { color: red }

2009… Modernizr for CSS3

Sniff features not browsers

.no-cssgradients .header {
background: url("images/glossybutton.png");
}

.cssgradients .header {
background-image: linear-gradient(deeppink, rebeccapurple);
}

Browser Testing Is Great When Possible

Browser Testing Is Required Constantly

This Site

  • List Markers
  • Text Decoration
  • Scroll Snap
  • Clip Path

Order of Appearance

Is a progressive-enhancement feature

This Site

  • Responsive Font Sizes
  • Grid Layout
  • Custom Properties

This Site

  • Background-Clip Text
  • Variable Fonts
  • Object Fit (for flexing images)

ToDo… Wide gamut colors in custom props

@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

/* touch screens */
@media (hover: none) and (pointer: coarse) { }

/* stylus-based screens */
@media (hover: none) and (pointer: fine) { }

/* gesture-based screens (Wii controller, Kinect) */
@media (hover: hover) and (pointer: coarse) { }

/* mouse & touch pad */
@media (hover: hover) and (pointer: fine) { }

More Resources

Support More Browsers With Lower Standards