Graphic design of unknown content with unknown collaborators, on an infinite and unknowable canvas, across operating systems, interfaces, languages, and writing modes…
–
me
So we’re here, supposed todo…
(slide)
It’s absurd
Web Design
Seems Impossible
Under those constraints,
design seemed impossible,but…
HTML totally eliminates any visual creativity that a document’s designer mighthave.
It didn’t invent selectors, or properties, or eveninheritance
It was the first to suggest an equal collaboration
Designed to soften thetension
Between the author and thereader
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 moresimilar.
To limited preference settings in a graphicinterface
Safari/WebKit: Settings / Advanced / Style sheet…
Firefox/Gecko: about:preferences
Chrome/Blink: chrome://settings/appearance
The details aredifferent
But the results are thesame
Users get to set some defaultpreferences
That are applied to every site theyvisit
And to beclear,
When we talk about ‘users’ or‘readers’
on the web…
We All Use TheWeb
More than we authorit
We’re talking about all ofus
We all use theweb
And I think it’s safe tosay
We spend more time using theweb
Than we spend buildingit
We can all
Have Preferences
And we’re all allowed to havepreferences!
Not just light mode or darkmode,
But fonts, font sizes, all ofit.
Go ahead…
Make The Web YourOwn
I used to worry as a dev - “but I’ll see something different than the user” - That’s the point! People might see something different! - Having a unique setting is a great way to rememberthat
Finally…
🎨 Author Styles
from the author origin
Finally, ‘document’ or ‘author’styles
(also us, making stuff for theweb)
We come last
🗺 Cascade Origins
🖥 User Agent Defaults (first, lowestpriority)
👥 User Preferences
🎨 Author Styles (last, toopowerful)
And so we get the highestpriority,
Last takes precedence,remember!
These are called the ‘cascadeorigins’
We override the userpreferences
Which override the browserdefaults
Which is a lot of power for us tohave!
Sometimes we’re not even payingattention
Or we throw afit…
And stomp around force-choking everyone in ourway
But Håkon wasclear…
If conflicts arise
the user should have the lastword
/* site styles */ html{background: red 100%;}/* only 36% */
And if the user requests 64%control,
It doesn’t matter how much wewant,
This isn’t winner-takes-all,
It’s first-come-first-served
And there’s only 36% remaining influence forus…
color-mix(in srgb, blue 64%, red)
And the result is a weighted average of ourstyles!
I wanted blue, but you asked forred,
So here’s the purple no one askedfor!
People immediately pointed out how this could gowrong
And how hard it would be to average other values likefonts
Although I wish we had tried harder on thatone
: User Author Font o-----x--------------o 64% Color o-x------------------o 90% Margin o-------------x------o 37% Volume o---------x----------o 50%
I honestly love this final diagram that Håkonprovides
ASCII art of a graphic interface with rangesliders
So users can fine-tune theirdesign
Live-mixing the relative weights of everydeclaration
html{background: blue;}/* 0% */ html{background: red !important;}/* 100% */
It was simplified into a binaryoption
0% by default, or 100% with the important flag…
🖥 User AgentDefaults
👥 User Preferences
🎨 Author Styles
❗🎨 Author Important
❗👥 User Important
❗🖥 User Agent Important
Important styles generate three neworigins!
They always win over normalstyles,
But now we go in reverse order–
Authors first, but then userpreferences
And the browser playscleanup
It’s a mirror universewhere
All our evil twins havegoatees
Yes, browsers defaults are oftenimportant
And users can set importantstyles
Using CSS inSafari
Or a checkbox in the Firefoxsettings
The purpose of…
❗Importance
Importance doesn’t change specificity
It changes theorigins
And the priority oforigins
The purpose…
Authors
👎🏼 Specificity Wars
With our own colleagues andlibraries
Is not for fighting eachother
In big teams who can’tagree
Or angrily trying tooverride
Styles we wrote lastyear
Browsers/Users
👍🏼 Protect Styles
From higher origins breaking importantthings
The purpose is for users and browsers
To protect style from futureorigins
Someone that might come alonglater…
That’s us
Importance exists to
protect our users from what we mightdo!
Often Isolated
…
…
🎨 Author Styles
❗🎨 Author Important
❗…
❗…
But the way our origins (normal andimportant)
Are isolated together…
We start tothink
We’re the center of theuniverse
When we’re really just one pale bluedot
In the solar system of thecascade
Which rotates around userneeds!
Fair, it’s what we deal with everyday
But we need to haveperspective
A Jedi uses the [Cascade]
for knowledge and defense,
never forattack.
–
Yoda (basically)
Graphic design of unknown content with unknown collaborators, on an infinite and unknowable canvas, across operating systems, interfaces, languages, and writing modes…
–
me
So now we’re not just dealingwith
some extreme unknowns
Infinite diversity in infinitecombinations
There are too many variables to consider. The point of CSS is to make it so you don’t have to worry about themall.
–
Keith J Grant
But the browser is allowed to ignoreus
And the user can override anything wesay
There are two manyvariables,
and everything we say is a suggestion…
The point of CSS is to make it
so you don’t have to worry about themall.
–
Keith J Grant
But everything we say is also a hint
Telling the browser something about our intent
CSS is
A Declarative Language
CSS is a declarativelanguage
width: 500px;
Some declarations seemsimple,
the width of abox
text-wrap: pretty;
While some are moreabstract,
wrapping text so it looks‘pretty’
(whatever that means)
width: 500px;
But even ‘simple’ declarations contain subtext
What do we mean by apixel?
Should this box get smaller
on a screen with higherresolution?
How should it respond to zooming in andout?
Are we setting the width of the contentbox?
(so padding and border are added to ourwidth)
Or the width of the entirebox,
so padding and border are subtracted to get the contentsize?
width: 100%; width: 90vw; width: 80cqi;
Should it be based on context
a parent element, viewport, orcontainer
flex: 1
Or flexible in relation to siblingelements
And remaining space
Or should we stop lookingsideways,
and look within
width: min-content; width: max-content;
To get the size of the contents
That’s a great suggestion,Jessica
Maybe it’s not the width we care about atall,
that’s just the direction textflows.
Are we trying to set the length of a line oftext?
inline-size: 45em;
Should it be based on the size of thefont?
width: min(45em, 100%);
Or some combination
Like the minimum, of twovalues
Everything in CSS basedon
constant back-and-forth
context pushing in,
(defining available space)
content pushing out
(taking up space)
How do we ensure
Our content willfit
any container we put it in?
width: auto;
We don’t have all the information, but the browserdoes
So the most useful tools inCSS
express this kind of abstract behavior
let the browser work out details
Like all designchoices
Our styles are contextual
Properties often behavedifferently
or not at all, depending on otherproperties
CSSproperties
Are Never Pure Functions
As a result, CSS features tend to be intertwined
Behavior is neverisolated,
And everything hasside-effects
We’re not doing functionalprogramming,
Expressive
Like Poetry
What we do is more expressive, likepoetry
Not describing the page in step-by-stepdetail
but communicating high-level ideas throughsubtext
Not just the result wewant
But the intent behind eachchoice
Subtext…16px!=1em
Units are great atthis
(it’s why CSS has so many ofthem)
On the surface 1em is sometimes16px
But they carry differentimplications
And adapt differently incontext
In CSS…flex!=grid
Similar with layoutmethods
We can sometimes get the sameresult
using either flexbox orgrid
But they move differently at theedges,
And our job, the entire reason we’rehere
Is not to make things look good on onedevice,
Or in a single browser,but…
Design For Change
The fact we can control a paper page is really a limitation of thatmedium.
To me, this meme
perfectly captures
what is actually awesome
about CSS –
and how we can go wrong
by taking too much control
without considering the consequences.
So how can we lighten our griphere?