SCALABLE CSS
Part 1 of 3: An origin Story.
1
Overview
4 The Early Days
4 Uncovering the Possibilities of CSS
4 Borrowing from OOP
...
4 Embracing the Global Namespace
4 Embracing Killing the Global Namespace
2
The Early Days
3
Before CSS
4 ~1960
4 1989
4 1991
4 1993
4
Before CSS
4 ~1960, OOP Principles are
founded.
4 1989
4 1991
4 1993
5
Before CSS
4 ~1960, OOP Principles are
founded.
4 1989, The Web is born.
4 1991
4 1993
6
Before CSS
4 ~1960, OOP Principles are
founded.
4 1989, The Web is born.
4 1991, The first Website goes live
4 1993
7
Before CSS
4 ~1960, OOP Principles are
founded.
4 1989, The Web is born.
4 1991, The first website goes live.
4 1993, Mosaic web browser is
released.
8
No, Craigslist was not the first
website...
9
But close enough...
10
It's not a bug -- it's a rendering choice made by
the browser. As we kneel before the altar of the
"ha ha, you can't control what your documents
look like in HTML
...
In fact, it has been a constant source of delight
for me over the past year to get to continually
tell hordes(literally) of people who want to --
strap yourselves in, here it comes -- control
what their documents look like
...
Sorry, you're screwed.
Marc
11
The Arrival of CSS
4 1994
4 1996
12
The Arrival of CSS
4 1994, Hakon Wium Lie proposes
the idea of CSS while working
with Tim Berners-Lee.
4 1996
13
The Arrival of CSS
4 1994, Hakon Wium Lie proposes
the idea of CSS while working
with Tim Berners-Lee.
4 1996, The first CCS1 spec
becomes official.
14
“The CSS1 language is human
readable and writable, and expresses
style in common desktop publishing
terminology.” -- W3Org
15
Recap
4 CSS1 spec becomes official December 17, 1996.
4 CSS draws it's influence from desktop publishing
software. (Not OOP).
4 CSS is created out of the necessity to make things
look good.
16
Uncovering the Possibilities
of CSS
17
What is CSS Really Capable of?
4 2003
18
What is CSS Really Capable of?
4 2003, Dave Shea launches the
CSS Zen Garden
19
20
21
2004
O'Reilly Media popularizes the term Web 2.0
22
2006
SASS (CSS in Ruby)
23
Borrowing from OOP
24
OOP Principles
4 DRY
4 Encapsulate what changes
4 Open Closed Design Principle
4 Single Responsibility Principle
(SRP)
25
Tabs
26
#EditorSidePanel .tabs {
border-bottom: 1px solid #d2d5d6;
height: 45px;
display: flex;
align-items: stretch;
padding: 10px 0 0;
}
#EditorSidePanel .tabs span {
display: inline-block;
font-weight: 400;
text-decoration: none;
padding: 0 10px;
text-align: center;
color: #0086bf;
font-weight: 600;
border-bottom: 5px solid #0086bf;
}
#EditorSidePanel .tabs a {
display: inline-block;
font-weight: 400;
text-decoration: none;
padding: 0 10px;
flex: 1 0 85px;
text-align: center;
}
27
Tabs HTML
<div id="EditorSidePanel">
<div class="tabs">
<span>STEPS</span>
<a>DOCUMENTS</a>
<a>COMMENTS</a>
</div>
</div>
28
Tabs CSS
4 ...
29
Tabs CSS
4 Is it DRY?
30
Tabs CSS
4 Is it DRY?
4 Is the functionality
encapsulated?
31
Tabs CSS
4 Is it DRY?
4 Is the functionality
encapsulated?
4 Is it open for extension?
32
Tabs CSS
4 Is it DRY?
4 Is the functionality
encapsulated?
4 Is it open for extension?
4 Does it serve a single
responsibility?
33
An object should look the same no matter where you put it
-- Nicole Sullivan
34
OOCSS
1. Separate Structure and Skin
2. Separate Container and Content
35
Tabs Challenge
4 Using the concepts of OOCSS
how might we refactor this
code?
4 What principles of OOP apply?
36
.pa-tabs {
border-bottom: 1px solid #d2d5d6;
height: 45px;
display: flex;
align-items: stretch;
padding: 10px 0 0;
}
.pa-tab {
font-weight: 400;
padding: 0 10px;
text-align: center;
}
.pa-tab-is-active {
color: #0086bf;
font-weight: 600;
border-bottom: 5px solid #0086bf;
}
37
The Rule of 3 does not apply to
Common UI Elements
38
Recap
4 Web 2.0 shifts the thinking from static to dynamic.
4 SASS extends the way CSS is written.
4 Modular CSS concepts begin to formalize.
39
2010 +
...to be continued
40
41

Scalable CSS | An Origin Story. (Part 1 of 3)

  • 1.
    SCALABLE CSS Part 1of 3: An origin Story. 1
  • 2.
    Overview 4 The EarlyDays 4 Uncovering the Possibilities of CSS 4 Borrowing from OOP ... 4 Embracing the Global Namespace 4 Embracing Killing the Global Namespace 2
  • 3.
  • 4.
    Before CSS 4 ~1960 41989 4 1991 4 1993 4
  • 5.
    Before CSS 4 ~1960,OOP Principles are founded. 4 1989 4 1991 4 1993 5
  • 6.
    Before CSS 4 ~1960,OOP Principles are founded. 4 1989, The Web is born. 4 1991 4 1993 6
  • 7.
    Before CSS 4 ~1960,OOP Principles are founded. 4 1989, The Web is born. 4 1991, The first Website goes live 4 1993 7
  • 8.
    Before CSS 4 ~1960,OOP Principles are founded. 4 1989, The Web is born. 4 1991, The first website goes live. 4 1993, Mosaic web browser is released. 8
  • 9.
    No, Craigslist wasnot the first website... 9
  • 10.
  • 11.
    It's not abug -- it's a rendering choice made by the browser. As we kneel before the altar of the "ha ha, you can't control what your documents look like in HTML ... In fact, it has been a constant source of delight for me over the past year to get to continually tell hordes(literally) of people who want to -- strap yourselves in, here it comes -- control what their documents look like ... Sorry, you're screwed. Marc 11
  • 12.
    The Arrival ofCSS 4 1994 4 1996 12
  • 13.
    The Arrival ofCSS 4 1994, Hakon Wium Lie proposes the idea of CSS while working with Tim Berners-Lee. 4 1996 13
  • 14.
    The Arrival ofCSS 4 1994, Hakon Wium Lie proposes the idea of CSS while working with Tim Berners-Lee. 4 1996, The first CCS1 spec becomes official. 14
  • 15.
    “The CSS1 languageis human readable and writable, and expresses style in common desktop publishing terminology.” -- W3Org 15
  • 16.
    Recap 4 CSS1 specbecomes official December 17, 1996. 4 CSS draws it's influence from desktop publishing software. (Not OOP). 4 CSS is created out of the necessity to make things look good. 16
  • 17.
  • 18.
    What is CSSReally Capable of? 4 2003 18
  • 19.
    What is CSSReally Capable of? 4 2003, Dave Shea launches the CSS Zen Garden 19
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
    OOP Principles 4 DRY 4Encapsulate what changes 4 Open Closed Design Principle 4 Single Responsibility Principle (SRP) 25
  • 26.
  • 27.
    #EditorSidePanel .tabs { border-bottom:1px solid #d2d5d6; height: 45px; display: flex; align-items: stretch; padding: 10px 0 0; } #EditorSidePanel .tabs span { display: inline-block; font-weight: 400; text-decoration: none; padding: 0 10px; text-align: center; color: #0086bf; font-weight: 600; border-bottom: 5px solid #0086bf; } #EditorSidePanel .tabs a { display: inline-block; font-weight: 400; text-decoration: none; padding: 0 10px; flex: 1 0 85px; text-align: center; } 27
  • 28.
    Tabs HTML <div id="EditorSidePanel"> <divclass="tabs"> <span>STEPS</span> <a>DOCUMENTS</a> <a>COMMENTS</a> </div> </div> 28
  • 29.
  • 30.
    Tabs CSS 4 Isit DRY? 30
  • 31.
    Tabs CSS 4 Isit DRY? 4 Is the functionality encapsulated? 31
  • 32.
    Tabs CSS 4 Isit DRY? 4 Is the functionality encapsulated? 4 Is it open for extension? 32
  • 33.
    Tabs CSS 4 Isit DRY? 4 Is the functionality encapsulated? 4 Is it open for extension? 4 Does it serve a single responsibility? 33
  • 34.
    An object shouldlook the same no matter where you put it -- Nicole Sullivan 34
  • 35.
    OOCSS 1. Separate Structureand Skin 2. Separate Container and Content 35
  • 36.
    Tabs Challenge 4 Usingthe concepts of OOCSS how might we refactor this code? 4 What principles of OOP apply? 36
  • 37.
    .pa-tabs { border-bottom: 1pxsolid #d2d5d6; height: 45px; display: flex; align-items: stretch; padding: 10px 0 0; } .pa-tab { font-weight: 400; padding: 0 10px; text-align: center; } .pa-tab-is-active { color: #0086bf; font-weight: 600; border-bottom: 5px solid #0086bf; } 37
  • 38.
    The Rule of3 does not apply to Common UI Elements 38
  • 39.
    Recap 4 Web 2.0shifts the thinking from static to dynamic. 4 SASS extends the way CSS is written. 4 Modular CSS concepts begin to formalize. 39
  • 40.
    2010 + ...to becontinued 40
  • 41.