CSS
IS
AWE
SOM
E
/* Break */
word-break: break-word;
height: auto;
solution one
Slide 10
Slide 10 text
CSS IS AWESOME
/* Content */
display: inline-block;
text-align: center;
solution two
Slide 11
Slide 11 text
CSS IS
AWES
OME
/* Container */
display: inline-block;
width: 150px;
height: 150px;
word-break: break-word;
solution three
Slide 12
Slide 12 text
CSS
IS
AWES
/* Overflow */
overflow: scroll;
solution four
Slide 13
Slide 13 text
/* Stack Overflow */
https://stackoverflow.com/
other solutions
Slide 14
Slide 14 text
SEPARATION OF CONCERNS
https://manzdev.github.io/htmlreally/
Slide 15
Slide 15 text
OLD PROBLEMS NIGHTMARES
IE6 IE9
cu rent
p o le yet
Float center
vertical Safari
Slide 16
Slide 16 text
First & second element colors?
.one { background: red; }
.two { background: blue; }
A: red, blue
C: red, red
B: blue, red
D: blue, blue
D: blue, blue
Prio ity
or er does 't atte
Slide 17
Slide 17 text
PROGRAMMER CSS is weird
Slide 18
Slide 18 text
Nicholas C. Zakas,
ESLint author
Instead of assuming that
people are dumb, ignorant,
and making mistakes,
assume they are smart, doing
their best, and that you lack
context.
Slide 19
Slide 19 text
First & second element colors?
.one.two { background: green; }
.two.one { background: purple; }
.one { background: red; }
.two { background: blue; }
A: blue, red
C: purple, purple
C: purple, purple
B: green, purple
D: green, green
Spe ifi it
020
020
010
010
Prio ity
Slide 20
Slide 20 text
? 0
Inline styles
1
IDs
2
Classes, attributes
and pseudo-classes
1
Elements and
pseudo-elements
#nav .selected > a:hover
.class {}
[attr=""] {}
:pseudoclass {}
#id { } element {}
::pseudoelem {}
CASCADE: SPECIFICITY
Slide 21
Slide 21 text
LA VIEJA CONFIABLE
!important
Slide 22
Slide 22 text
!important
BAD PRACTICES
Slide 23
Slide 23 text
BAD PRACTICES
.page .container .main
.grid-parent
ul
.item > div
li .element span { ... }
Slide 24
Slide 24 text
BAD PRACTICES
z-index: 1;
z-index: 5;
z-index: 99999;
z-index: 99;
postcss-preset-env
rucksack-css
ESTÁNDAR NO ESTÁNDAR
postcss-font-magician
?
? ?
Slide 66
Slide 66 text
FOR DESIGNERS:
CASCADE
THE "C" IN CSS...
FOR PROGRAMMERS:
COLLISION
Slide 67
Slide 67 text
No content
Slide 68
Slide 68 text
THE GREAT
DIVIDE
https://css-tricks.com/the-great-divide/
Slide 69
Slide 69 text
PROGRAMMER DESIGNER
Local scope Global scope
HTML as an end asset Semantic HTML
Composition Cascade/Inheritance
Compiling (transpilers) How browser works
CSS is broken!!
CSS doesn't scale
Break the web!!
Learn CSS instead
of avoiding it!!
Slide 70
Slide 70 text
GLOBAL
COMPONENT
COMPONENT COMPONENT
COMPONENT
LOCAL
Slide 71
Slide 71 text
No content
Slide 72
Slide 72 text
document.body.innerHTML = `
div {
color: red;
}
Hello!
`;
innerHTML
ES2015+
glo l
Slide 73
Slide 73 text
const div = document.createElement('div');
div.textContent = 'Hello!';
div.style.color = 'red';
document.body.append(div);
inline styles
lo
WebComponent
LightDOM
WebComponent
ShadowDOM (open)
CSS Global a ects DOM selectable
WebComponent
ShadowDOM (closed)
Slide 93
Slide 93 text
PRESENT
{ HTML Templates }
{ Shadow DOM }
{ Custom Elements }
FUTURE
{ CSS Modules }
{ HTML Modules }
{ JSON Modules }
Slide 94
Slide 94 text
CONSTRUCTABLES STYLE SHEETS
const css = new CSSStyleSheet();
css.insertRule('h2 { background: red }');
this.shadowRoot.adoptedStyleSheets = [css];
Slide 95
Slide 95 text
PRESENT
{ HTML Templates }
{ Shadow DOM }
{ Custom Elements }
FUTURE
{ CSS Modules }
{ HTML Modules }
{ JSON Modules }
import html from './BaseElement.html';
import json from './BaseElementData.json';
import sheet from './BaseElement.css';
Mark Dalgleish,
CSS Modules author
I think people often reject
these new ideas so strongly
because they feel like
they're being left behind in
the linear view of history.