SlideShare a Scribd company logo
1 of 79
Download to read offline
An Introduction to Object Oriented CSS
Scalable and Maintainable Stylesheets
Nati Devalle - @Taly
UX Designer
Starting a project from scratch
6 months later...
WHY?
We keep piling styles up
instead of reusing them
Where do we start?
http://www.flickr.com/photos/mrlemming_photos/5750248841/
Object
Oriented
CSS
by Nicole Sullivan
2 Principles
1. Separation of Structure from Skin
2. Separation of Containers from Content
2 Principles
1. Separation of Structure from Skin
2. Separation of Containers from Content
Structure Skin
Structure Skin
Scalable
.ch-box-error {}
.ch-box-attention {}
Scalable
.ch-box-error {}
.ch-box-attention {}
.ch-box-help {}
.ch-box-information {}
.ch-box-ok {}
Maintainable
[class*='ch-box'] {
border-radius: 5px;
padding: 10px;
margin: 0 0 10px 0;
}
Maintainable
[class*='ch-box'] {
border-radius: 20px;
padding: 10px;
margin: 0 0 10px 0;
}
2 Principles
1. Separation of Structure from Skin
2. Separation of Containers from Content
What’s Content?
What’s Container?
http://www.html5code.com/tutorials/html5-semantic-layout-tags/
Break the dependency
between content and container
(So you can put the content in different containers)
Use styles that are
specific to an element
and
don’t depend on location
The Recipe
1. Identify the pattern
2. Create a component library
3. Extend it
http://www.flickr.com/photos/mlazarevski/8108416027/sizes/l/in/photostre
What’s
The
Pattern?
How did we code this?
How did we code this?
How did we code this?
Pattern = Reusable
(and consistency)
Create a component
Extend
Too similar?
Choose one!
Extend more
Exceptions
Not bad
But it is really necessary?
Today
7 badges
Saved 18+ repeated declarations
20 badges
Saved 57+ repeated declarations
And that’s just ONE pattern
Think of all the others we can find
http://www.flickr.com/photos/bdesham/2432400623/in/photostream/
and this
and thiscould be just this
Success!
This could be very tempting...
But what if it changes?
Future-proof
Don’t forget about semantics
Embrace Semantics
To sum it up...
If you have to copy and paste
just one single CSS declaration...
( Tweet me at @Taly )
● http://oocss.org/
● http://www.slideshare.net/stubbornella/object-oriented-css
● http://www.slideshare.net/stubbornella/what-is-object-oriented-css
● https://www.youtube.com/watch?v=EW8NAFELWzo
● http://www.stubbornella.org/content/2010/06/25/the-media-object-
saves-hundreds-of-lines-of-code/
● http://www.slideshare.net/stubbornella/5-mistakes-of-massive-css
● http://www.lukew.com/ff/entry.asp?1049
● http://coding.smashingmagazine.com/2011/12/12/an-introduction-to-
object-oriented-css-oocss/
● http://www.sitepoint.com/css-architectures-scalable-and-modular-
approaches/
● https://www.google.com.ar/search?q=OOCSS
Resources

More Related Content

Similar to An Introduction to Object Oriented CSS

The New UI - Staying Strong with Flexbox, SASS, and {{Mustache.js}}
The New UI - Staying Strong with Flexbox, SASS, and {{Mustache.js}}The New UI - Staying Strong with Flexbox, SASS, and {{Mustache.js}}
The New UI - Staying Strong with Flexbox, SASS, and {{Mustache.js}}Eric Carlisle
 
OOCSS for JavaScript Pirates jQcon Boston
OOCSS for JavaScript Pirates jQcon BostonOOCSS for JavaScript Pirates jQcon Boston
OOCSS for JavaScript Pirates jQcon BostonJohn Hann
 
HTML Tour - Buenas prácticas en el desarrollo web
HTML Tour - Buenas prácticas en el desarrollo webHTML Tour - Buenas prácticas en el desarrollo web
HTML Tour - Buenas prácticas en el desarrollo webPlain Concepts
 
Extreme CSS Techniques - MadWorld Europe 2018, Scott DeLoach, ClickStart
Extreme CSS Techniques - MadWorld Europe 2018, Scott DeLoach, ClickStartExtreme CSS Techniques - MadWorld Europe 2018, Scott DeLoach, ClickStart
Extreme CSS Techniques - MadWorld Europe 2018, Scott DeLoach, ClickStartScott DeLoach
 
Thoughtful architecture and good practices in CSS - myth or new realities
Thoughtful architecture and good practices in CSS - myth or new realitiesThoughtful architecture and good practices in CSS - myth or new realities
Thoughtful architecture and good practices in CSS - myth or new realitiesAnna Matysiak
 
The New CSS Layout - Dutch PHP Conference
The New CSS Layout - Dutch PHP ConferenceThe New CSS Layout - Dutch PHP Conference
The New CSS Layout - Dutch PHP ConferenceRachel Andrew
 
Newcastle University & T4 Site Manager: TERMINALFOUR t44u 2013
Newcastle University & T4 Site Manager: TERMINALFOUR t44u 2013Newcastle University & T4 Site Manager: TERMINALFOUR t44u 2013
Newcastle University & T4 Site Manager: TERMINALFOUR t44u 2013Terminalfour
 
Modular HTML & CSS Workshop
Modular HTML & CSS WorkshopModular HTML & CSS Workshop
Modular HTML & CSS WorkshopShay Howe
 
Object oriented css graeme blackwood
Object oriented css graeme blackwoodObject oriented css graeme blackwood
Object oriented css graeme blackwooddrupalconf
 
How to develop a CSS Framework
How to develop a CSS FrameworkHow to develop a CSS Framework
How to develop a CSS FrameworkOlivier Besson
 
960 grid psd
960 grid psd960 grid psd
960 grid psdRaju Nag
 
Scalable and Modular Architecture for CSS
Scalable and Modular Architecture for CSSScalable and Modular Architecture for CSS
Scalable and Modular Architecture for CSSJyaasa Technologies
 
Object oriented css. Graeme Blackwood
Object oriented css. Graeme BlackwoodObject oriented css. Graeme Blackwood
Object oriented css. Graeme BlackwoodPVasili
 
Drupal 960 grid system based theming
Drupal 960 grid system based theming Drupal 960 grid system based theming
Drupal 960 grid system based theming Gaurav Mishra
 
Javascript Design Patterns
Javascript Design PatternsJavascript Design Patterns
Javascript Design PatternsLilia Sfaxi
 
Scoped CSS: To scope or not to scope
Scoped CSS: To scope or not to scopeScoped CSS: To scope or not to scope
Scoped CSS: To scope or not to scopeShi Ling Tai
 

Similar to An Introduction to Object Oriented CSS (20)

The New UI - Staying Strong with Flexbox, SASS, and {{Mustache.js}}
The New UI - Staying Strong with Flexbox, SASS, and {{Mustache.js}}The New UI - Staying Strong with Flexbox, SASS, and {{Mustache.js}}
The New UI - Staying Strong with Flexbox, SASS, and {{Mustache.js}}
 
OOCSS for JavaScript Pirates jQcon Boston
OOCSS for JavaScript Pirates jQcon BostonOOCSS for JavaScript Pirates jQcon Boston
OOCSS for JavaScript Pirates jQcon Boston
 
Class15
Class15Class15
Class15
 
HTML Tour - Buenas prácticas en el desarrollo web
HTML Tour - Buenas prácticas en el desarrollo webHTML Tour - Buenas prácticas en el desarrollo web
HTML Tour - Buenas prácticas en el desarrollo web
 
Extreme CSS Techniques - MadWorld Europe 2018, Scott DeLoach, ClickStart
Extreme CSS Techniques - MadWorld Europe 2018, Scott DeLoach, ClickStartExtreme CSS Techniques - MadWorld Europe 2018, Scott DeLoach, ClickStart
Extreme CSS Techniques - MadWorld Europe 2018, Scott DeLoach, ClickStart
 
Thoughtful architecture and good practices in CSS - myth or new realities
Thoughtful architecture and good practices in CSS - myth or new realitiesThoughtful architecture and good practices in CSS - myth or new realities
Thoughtful architecture and good practices in CSS - myth or new realities
 
The New CSS Layout - Dutch PHP Conference
The New CSS Layout - Dutch PHP ConferenceThe New CSS Layout - Dutch PHP Conference
The New CSS Layout - Dutch PHP Conference
 
Newcastle University & T4 Site Manager: TERMINALFOUR t44u 2013
Newcastle University & T4 Site Manager: TERMINALFOUR t44u 2013Newcastle University & T4 Site Manager: TERMINALFOUR t44u 2013
Newcastle University & T4 Site Manager: TERMINALFOUR t44u 2013
 
Modular HTML & CSS Workshop
Modular HTML & CSS WorkshopModular HTML & CSS Workshop
Modular HTML & CSS Workshop
 
Object oriented css graeme blackwood
Object oriented css graeme blackwoodObject oriented css graeme blackwood
Object oriented css graeme blackwood
 
Css framework
Css frameworkCss framework
Css framework
 
How to develop a CSS Framework
How to develop a CSS FrameworkHow to develop a CSS Framework
How to develop a CSS Framework
 
Css framework
Css frameworkCss framework
Css framework
 
960 grid psd
960 grid psd960 grid psd
960 grid psd
 
Scalable and Modular Architecture for CSS
Scalable and Modular Architecture for CSSScalable and Modular Architecture for CSS
Scalable and Modular Architecture for CSS
 
Refresh OKC
Refresh OKCRefresh OKC
Refresh OKC
 
Object oriented css. Graeme Blackwood
Object oriented css. Graeme BlackwoodObject oriented css. Graeme Blackwood
Object oriented css. Graeme Blackwood
 
Drupal 960 grid system based theming
Drupal 960 grid system based theming Drupal 960 grid system based theming
Drupal 960 grid system based theming
 
Javascript Design Patterns
Javascript Design PatternsJavascript Design Patterns
Javascript Design Patterns
 
Scoped CSS: To scope or not to scope
Scoped CSS: To scope or not to scopeScoped CSS: To scope or not to scope
Scoped CSS: To scope or not to scope
 

Recently uploaded

Unit1_Syllbwbnwnwneneneneneneentation_Sem2.pptx
Unit1_Syllbwbnwnwneneneneneneentation_Sem2.pptxUnit1_Syllbwbnwnwneneneneneneentation_Sem2.pptx
Unit1_Syllbwbnwnwneneneneneneentation_Sem2.pptxNitish292041
 
simpson-lee_house_dt20ajshsjsjsjsjj15.pdf
simpson-lee_house_dt20ajshsjsjsjsjj15.pdfsimpson-lee_house_dt20ajshsjsjsjsjj15.pdf
simpson-lee_house_dt20ajshsjsjsjsjj15.pdfLucyBonelli
 
Pharmaceutical Packaging for the elderly.pdf
Pharmaceutical Packaging for the elderly.pdfPharmaceutical Packaging for the elderly.pdf
Pharmaceutical Packaging for the elderly.pdfAayushChavan5
 
Karim apartment ideas 01 ppppppppppppppp
Karim apartment ideas 01 pppppppppppppppKarim apartment ideas 01 ppppppppppppppp
Karim apartment ideas 01 pppppppppppppppNadaMohammed714321
 
Making and Unmaking of Chandigarh - A City of Two Plans2-4-24.ppt
Making and Unmaking of Chandigarh - A City of Two Plans2-4-24.pptMaking and Unmaking of Chandigarh - A City of Two Plans2-4-24.ppt
Making and Unmaking of Chandigarh - A City of Two Plans2-4-24.pptJIT KUMAR GUPTA
 
Iconic Global Solution - web design, Digital Marketing services
Iconic Global Solution - web design, Digital Marketing servicesIconic Global Solution - web design, Digital Marketing services
Iconic Global Solution - web design, Digital Marketing servicesIconic global solution
 
General Knowledge Quiz Game C++ CODE.pptx
General Knowledge Quiz Game C++ CODE.pptxGeneral Knowledge Quiz Game C++ CODE.pptx
General Knowledge Quiz Game C++ CODE.pptxmarckustrevion
 
Karim apartment ideas 02 ppppppppppppppp
Karim apartment ideas 02 pppppppppppppppKarim apartment ideas 02 ppppppppppppppp
Karim apartment ideas 02 pppppppppppppppNadaMohammed714321
 
Giulio Michelon, Founder di @Belka – “Oltre le Stime: Sviluppare una Mentalit...
Giulio Michelon, Founder di @Belka – “Oltre le Stime: Sviluppare una Mentalit...Giulio Michelon, Founder di @Belka – “Oltre le Stime: Sviluppare una Mentalit...
Giulio Michelon, Founder di @Belka – “Oltre le Stime: Sviluppare una Mentalit...Associazione Digital Days
 
guest bathroom white and bluesssssssssss
guest bathroom white and bluesssssssssssguest bathroom white and bluesssssssssss
guest bathroom white and bluesssssssssssNadaMohammed714321
 
Pearl Disrtrict urban analyusis study pptx
Pearl Disrtrict urban analyusis study pptxPearl Disrtrict urban analyusis study pptx
Pearl Disrtrict urban analyusis study pptxDanielTamiru4
 
world health day 2024.pptxgbbvggvbhjjjbbbb
world health day 2024.pptxgbbvggvbhjjjbbbbworld health day 2024.pptxgbbvggvbhjjjbbbb
world health day 2024.pptxgbbvggvbhjjjbbbbpreetirao780
 
How to Empower the future of UX Design with Gen AI
How to Empower the future of UX Design with Gen AIHow to Empower the future of UX Design with Gen AI
How to Empower the future of UX Design with Gen AIyuj
 
Map of St. Louis Parks
Map of St. Louis Parks                              Map of St. Louis Parks
Map of St. Louis Parks CharlottePulte
 
办理卡尔顿大学毕业证成绩单|购买加拿大文凭证书
办理卡尔顿大学毕业证成绩单|购买加拿大文凭证书办理卡尔顿大学毕业证成绩单|购买加拿大文凭证书
办理卡尔顿大学毕业证成绩单|购买加拿大文凭证书zdzoqco
 
Color Theory Explained for Noobs- Think360 Studio
Color Theory Explained for Noobs- Think360 StudioColor Theory Explained for Noobs- Think360 Studio
Color Theory Explained for Noobs- Think360 StudioThink360 Studio
 
Piece by Piece Magazine
Piece by Piece Magazine                      Piece by Piece Magazine
Piece by Piece Magazine CharlottePulte
 
Interior Design for Office a cura di RMG Project Studio
Interior Design for Office a cura di RMG Project StudioInterior Design for Office a cura di RMG Project Studio
Interior Design for Office a cura di RMG Project StudioRMG Project Studio
 
group_15_empirya_p1projectIndustrial.pdf
group_15_empirya_p1projectIndustrial.pdfgroup_15_empirya_p1projectIndustrial.pdf
group_15_empirya_p1projectIndustrial.pdfneelspinoy
 
10 must-have Chrome extensions for designers
10 must-have Chrome extensions for designers10 must-have Chrome extensions for designers
10 must-have Chrome extensions for designersPixeldarts
 

Recently uploaded (20)

Unit1_Syllbwbnwnwneneneneneneentation_Sem2.pptx
Unit1_Syllbwbnwnwneneneneneneentation_Sem2.pptxUnit1_Syllbwbnwnwneneneneneneentation_Sem2.pptx
Unit1_Syllbwbnwnwneneneneneneentation_Sem2.pptx
 
simpson-lee_house_dt20ajshsjsjsjsjj15.pdf
simpson-lee_house_dt20ajshsjsjsjsjj15.pdfsimpson-lee_house_dt20ajshsjsjsjsjj15.pdf
simpson-lee_house_dt20ajshsjsjsjsjj15.pdf
 
Pharmaceutical Packaging for the elderly.pdf
Pharmaceutical Packaging for the elderly.pdfPharmaceutical Packaging for the elderly.pdf
Pharmaceutical Packaging for the elderly.pdf
 
Karim apartment ideas 01 ppppppppppppppp
Karim apartment ideas 01 pppppppppppppppKarim apartment ideas 01 ppppppppppppppp
Karim apartment ideas 01 ppppppppppppppp
 
Making and Unmaking of Chandigarh - A City of Two Plans2-4-24.ppt
Making and Unmaking of Chandigarh - A City of Two Plans2-4-24.pptMaking and Unmaking of Chandigarh - A City of Two Plans2-4-24.ppt
Making and Unmaking of Chandigarh - A City of Two Plans2-4-24.ppt
 
Iconic Global Solution - web design, Digital Marketing services
Iconic Global Solution - web design, Digital Marketing servicesIconic Global Solution - web design, Digital Marketing services
Iconic Global Solution - web design, Digital Marketing services
 
General Knowledge Quiz Game C++ CODE.pptx
General Knowledge Quiz Game C++ CODE.pptxGeneral Knowledge Quiz Game C++ CODE.pptx
General Knowledge Quiz Game C++ CODE.pptx
 
Karim apartment ideas 02 ppppppppppppppp
Karim apartment ideas 02 pppppppppppppppKarim apartment ideas 02 ppppppppppppppp
Karim apartment ideas 02 ppppppppppppppp
 
Giulio Michelon, Founder di @Belka – “Oltre le Stime: Sviluppare una Mentalit...
Giulio Michelon, Founder di @Belka – “Oltre le Stime: Sviluppare una Mentalit...Giulio Michelon, Founder di @Belka – “Oltre le Stime: Sviluppare una Mentalit...
Giulio Michelon, Founder di @Belka – “Oltre le Stime: Sviluppare una Mentalit...
 
guest bathroom white and bluesssssssssss
guest bathroom white and bluesssssssssssguest bathroom white and bluesssssssssss
guest bathroom white and bluesssssssssss
 
Pearl Disrtrict urban analyusis study pptx
Pearl Disrtrict urban analyusis study pptxPearl Disrtrict urban analyusis study pptx
Pearl Disrtrict urban analyusis study pptx
 
world health day 2024.pptxgbbvggvbhjjjbbbb
world health day 2024.pptxgbbvggvbhjjjbbbbworld health day 2024.pptxgbbvggvbhjjjbbbb
world health day 2024.pptxgbbvggvbhjjjbbbb
 
How to Empower the future of UX Design with Gen AI
How to Empower the future of UX Design with Gen AIHow to Empower the future of UX Design with Gen AI
How to Empower the future of UX Design with Gen AI
 
Map of St. Louis Parks
Map of St. Louis Parks                              Map of St. Louis Parks
Map of St. Louis Parks
 
办理卡尔顿大学毕业证成绩单|购买加拿大文凭证书
办理卡尔顿大学毕业证成绩单|购买加拿大文凭证书办理卡尔顿大学毕业证成绩单|购买加拿大文凭证书
办理卡尔顿大学毕业证成绩单|购买加拿大文凭证书
 
Color Theory Explained for Noobs- Think360 Studio
Color Theory Explained for Noobs- Think360 StudioColor Theory Explained for Noobs- Think360 Studio
Color Theory Explained for Noobs- Think360 Studio
 
Piece by Piece Magazine
Piece by Piece Magazine                      Piece by Piece Magazine
Piece by Piece Magazine
 
Interior Design for Office a cura di RMG Project Studio
Interior Design for Office a cura di RMG Project StudioInterior Design for Office a cura di RMG Project Studio
Interior Design for Office a cura di RMG Project Studio
 
group_15_empirya_p1projectIndustrial.pdf
group_15_empirya_p1projectIndustrial.pdfgroup_15_empirya_p1projectIndustrial.pdf
group_15_empirya_p1projectIndustrial.pdf
 
10 must-have Chrome extensions for designers
10 must-have Chrome extensions for designers10 must-have Chrome extensions for designers
10 must-have Chrome extensions for designers
 

An Introduction to Object Oriented CSS