Let’s do this…
You can’t make a web that’s world-wide, by saying it works on my machine, and everyone else is an edge-case.
Web for all. Web on everything.
— W3C Mission Statement
Web for all. Web on everything.
— W3C Mission Statement
[DEMO]
across devices, and over time
It is required that HTML be a common language between all platforms…
— WWW Project, HTML constraints
…This implies no device-specific markup, or anything which requires control over fonts or colors.
— WWW Project, HTML constraints
The fact we can control a paper page is really a limitation of that medium.
— John Allsopp, A Dao of Web Design
@media
min-width
@media
prefers-reduced-motion
@media
hover
@supports
container-type: inline-size
HTML totally eliminates any visual creativity that a document’s designer might have.
— Roy Smith, www-talk “Re: Adobe’s PDF”
The web would have become a giant fax machine where pictures of text would be passed along.
— Håkon Lie, 2014 interview
…Allow the author to attach style hints.
— Håkon Lie, Cascading HTML style sheets – a proposal
Styles are suggestions or hints about behavior, not rules…
— Robert Raisch, Request for comments: STYLESHEETS
Provide hints that the browser may or may not use.
— Håkon Lie, Cascading HTML style sheets – a proposal
A set of HINTS or SUGGESTIONS to the renderer which might be used…
— Robert Raisch, Request for comments: STYLESHEETS
Provide authors and publishers with stylistic influence without resorting to page description languages.
— Håkon Lie, Cascading HTML style sheets – a proposal
The CHSS proposal is explicitly designed around this collaboration
This proposal tries to soften the tension between the author and the reader.
— Håkon Lie, Cascading HTML style sheets – a proposal
The user/browser specifies initial preferences and hands the remaining influence over to the document [authors].
— Håkon Lie, Cascading HTML style sheets – a proposal
/* a 'declaration' */
property: value;
/* a 'declaration' */
color: blue;
/* a 'declaration' */
color: blue 64%;
36%
of the influence/* a 'declaration' */
color: blue !important;
/* a 'declaration' */
color: blue;
/* a 'block' */
{
background: white;
color: mediumVioletRed;
}
<!-- 'inline' (or 'element attached') styles -->
<p style="
background: white;
color: mediumVioletRed;
">…</p>
<p style="color: mediumVioletRed;">…</p>
<p style="color: mediumVioletRed;">…</p>
<p style="color: mediumVioletRed;">…</p>
<p style="color: mediumVioletRed;">…</p>
<p style="color: mediumVioletRed;">…</p>
…A simple mapping between HTML elements and presentation hints.
— Håkon Lie, Cascading HTML style sheets – a proposal
/* a selector, with attached declarations… */
/* a 'style rule' (or 'rule set') */
p {
background: white;
color: mediumVioletRed;
}
<p>This is a short paragraph</p>
p { … }
<!-- a 'style sheet' -->
<link rel="stylesheet" href="styles.css">
/* another 'style sheet' */
@import url('styles.css');
An ordered list (cascade) of style sheets.
— Håkon Lie, Cascading HTML style sheets – a proposal
<button type="submit" id="send" class="action">
button { background: gray; }
.action { background: darkBlue; }
[type=“submit”] { background: darkGreen;
background: var(--submit, black); }
#send { background: maroon; }
#484d63
/* a 'declaration' */
color: blue 64%;
* including Editor’s Draft proposals
<button>
Needs
One Background-Color
Color
Padding-Left
Margin-Inline-End
color
,padding-left
,margin-inline-end
, etc.applying declarations to selectors
removes extra values
fills in missing values
0+
declared values)0|1
cascaded value)1
specified value)1
computed value)1
used value)1
actual value).short { border: thin double; }
.long {
border-top: thin double;
border-left: thin double;
border-bottom: thin double;
border-right: thin double;
border-image: none;
}
border-image
Border
is shorthand for setting all of them.short { border: thin double; }
.long {
/* declared */
border-top-width: thin;
border-top-style: double;
/* reset to 'initial' value */
border-top-color: currentColor;
border-image: none;
}
width
, style
, and color
of eachcurrentColor
border-image
which is reset-only here/* a 'declaration' */
property: value;
this forms the series of steps in our funnel, asking…
This proposal tries to soften the tension between the author and the reader.
— Håkon Lie, Cascading HTML style sheets – a proposal
The user/browser specifies initial preferences…
— Håkon Lie, Cascading HTML style sheets – a proposal
from the user agent origin
demo:
/* initial values */
display: inline;
background: transparent;
color: CanvasText;
font-style: normal;
flex-basis: auto;
/* etc. */
display:inline
, even on div
s…html { display: block; }
body { display: block; }
p { display: block; }
div { display: block; }
article, aside, footer, header, hgroup,
main, nav, search, section { display: block }
address { display: block; }
blockquote { display: block; }
/* etc etc */
display:block
body { margin: 8px; }
a:link {
color: blue;
text-decoration: underline; }
h1, h2, h3, h4 /* etc */ {
font-weight: bold;
font-size: something big I dunno; }
8px
margin on the body
resource://gre-resources/
from the user origin
[CSS] provides author and reader with the same notation…
— Håkon Lie, Cascading HTML style sheets – a proposal
Settings / Advanced / Style sheet…
about:preferences
chrome://settings/appearance
all of us read other people’s web sites
from the author origin
This proposal tries to soften the tension between the author and the reader.
— Håkon Lie, Cascading HTML style sheets – a proposal
If conflicts arise the user should have the last word
— Håkon Lie, Cascading HTML style sheets – a proposal
If a trade-off needs to be made, always put user needs above all.
!important
to a declaration…!important
mirror universeresource://gre-resources/
!important
behaviorWith our own colleagues and libraries
From higher origins breaking important things
in transitions and animations
hotPink
»
teal
hotPink
rgb(93 138 220)
?!
teal
hotPink
and teal
button {
background: teal;
transition: background 1s;
}
button:hover { background: hotPink !important; }
:target { animation: bg-change 3s ease-in both; }
@keyframes bg-change {
from { background: pink; }
to { background: cyan; }
}
animation
property is in the cascade!important
keyframes [present, debug]!important
, and then it’s reversedstyling web components
Context
in the cascadesimilar to user agent origin
(demo if needed)
and reverses priority
@layer settings { … }
@layer tools { … }
@layer generic { … }
@layer elements { … }
@layer objects { … }
@layer components { … }
@layer overrides { … }
!important
->
Layers ->
Importance
@layer reset {
[hidden] { display: none !important; }
}
Web for all. Web on everything.
— W3C Mission Statement
<p style="color: mediumVioletRed;">…</p>
<p style="color: mediumVioletRed;">…</p>
<p style="color: mediumVioletRed;">…</p>
<p style="color: mediumVioletRed;">…</p>
<p style="color: mediumVioletRed;">…</p>
Graphic design of unknown content with unknown collaborators, on an infinite and unknowable canvas, across operating systems, interfaces, languages, and writing modes…
— me
A Jedi uses the [Cascade] for knowledge and defense, never for attack.
— Yoda (basically)