SlideShare a Scribd company logo
1 of 49
Download to read offline
Joomla!dagen Nederland 2014
OOCSS - Keep it small
Babs Gösgens
e @babsgosgens
#jd14nl
www.crossinghippos.com
er @crossinghippos
Joomla!dagen Nederland 2014
Modular CSS
–Hugo Giraudel (@HugoGiraudel )
“CSS has become more interesting and more
complicated.”
h p://www.sitepoint.com/architecture-sass-project/
WET
Be er ?
Context
Be er ?
Re-usability
Be er ?
(Cross media) Semantics
Be er ?
Persistent Grid
Be er ?
Facebook
• 6498 colour declarations
• 548 unique colours
• 261 shades of “Facebook” blue
• 3668 padding declarations
• 511 heading selectors
Source: thekmiecs.com
Media Object
• 5 Lines of CSS
• A small HTML snippet
Media Object
Nicole Sullivan
OOCSS in 2009
(@stubbornella)
Source: Joshua Kulpa via Flickr CC
OOCSS
• Separate structure and skin
• Separate container and content







Modular
f
DRY
f
Scalable
f
+ =
Small sites can grow big
Source: Harry Roberts (@csswizardry)
less CSS = faster site
Object
• HTML
• CSS
• JavaScript
• …
OOCSS Systemen
• OOCSS
• SMACCS
• BEM
• Atomic CSS
• …
BEM
Block-Element-Modifier
Block
• Independent Entity
• Blocks can contain other blocks

Bron: h p://bem.info/method/definitions/
Element
• Smallest part of a block
• Context-dependent
Bron: h p://bem.info/method/definitions/
Modifier
• Extra, or different property
• Multiple modifiers
Bron: h p://bem.info/method/definitions/
BEM Classes
.block { }
.block__element { }
.block--modifier { }
Person
Media Object in BEM
Not everything is BEM
–W3C
“Good names don’t change.”
h p://www.w3.org/QA/Tips/goodclassnames
Class names
• a warning, important, submenu
• b border4px, ligh ext, pre ybackground



h p://www.w3.org/QA/Tips/goodclassnames
Classisitis
• Repeating classes are excellent
candidates for compression



Source: h p://www.staceyreid.com
Good habits
• Use shallow selectors
• Separate skin and behavior
• Avoid repetition (DRY)
• Avoid context
• Avoid having to rewrite properties
• Comments, comments and comments
Bad habits
• Overqualified selectors
• Overly specific selectors
• Universal selector
• ID’s for styling
• !important
.menu#mainmenu.block > .block__element*
Specificity
• Universal selectors
• Tag (type) selectors
• Class selectors
• A ribute selectors
• Pseudo-classes & Pseudo-elements
• ID selectors
• Inline styles
*a, div, article.block[type=“checkbox”]:first-child, ::before#mainmenustyle=“color: #f00;”
bad!
Methods
• Structure
• Ordering
• Context
• Comments
• Semantics (for us)
CSS Preprocessors
• Variables
• Functions
• Mixins & placeholders
• Inheritance
• Operators & directives
• Maps
– J.R.R. Tolkien (& Hugo Giraudel)
“One file to rule them all,
One file to find them,
One file to bring them all,
And in the Sass way merge them.”
Partials
• Every component in its own file
• Individual files are pulled in 

to create a single stylesheet
• Much easier to maintain
Source: h p://www.sitepoint.com/architecture-sass-project/
SASS & BEM
SASS & BEM
Abstraction exercise
Abstraction exercise
Sources
• h p://bem.info/
• h p://bradfrostweb.com/blog/post/atomic-web-design/
• h p://clubmate.fi/oocss-acss-bem-smacss-what-are-they-
what-should-i-use/
• h p://coding.smashingmagazine.com/2011/12/12/an-
introduction-to-object-oriented-css-oocss/
• h p://csswizardry.com/2011/09/writing-efficient-css-
selectors/
• h p://csswizardry.com/2013/01/mindbemding-ge ing-
your-head-round-bem-syntax/
• h p://hugogiraudel.com/
• h p://nicoespeon.com/en/2013/05/dive-into-oocss/
• h p://nicolasgallagher.com/about-html-semantics-front-
end-architecture/
• h p://rhodesmill.org/brandon/2011/concentric-css/
• h p://sass-lang.com/
• h p://smacss.com/
• h p://snook.ca/
• h p://www.alwaystwisted.com/post.php?s=2014-02-27-
even-easier-bem-ing-with-sass-33
• h p://www.bre jankord.com/2013/02/09/thoughts-on-
semantic-html-class-names-and-maintainability/
• h p://www.mathayward.com/modular-css-with-sass-
and-bem/
• h p://www.sitepoint.com/architecture-sass-project/
• h p://www.sitepoint.com/css-sass-styleguide/
• h p://www.slideshare.net/maxdesign/css-oocss-and-
smacss
• h ps://github.com/necolas/idiomatic-css
• h ps://github.com/stubbornella/oocss/wiki
a
www.facebook.com/crossinghippos

h p://www.slideshare.net/babsgosgens

More Related Content

What's hot

%&*#! Stupid Puzzles
%&*#! Stupid Puzzles%&*#! Stupid Puzzles
%&*#! Stupid Puzzles
Jeff Campbell
 
Introduction to ruby
Introduction to rubyIntroduction to ruby
Introduction to ruby
Andrew Liu
 
Tarea de Geometria Juanpi
Tarea de Geometria JuanpiTarea de Geometria Juanpi
Tarea de Geometria Juanpi
Jpablo14
 
Introduction to Browser DOM
Introduction to Browser DOMIntroduction to Browser DOM
Introduction to Browser DOM
Siva Arunachalam
 

What's hot (15)

Drupal - Introduction to Drupal Template Design
Drupal - Introduction to Drupal Template DesignDrupal - Introduction to Drupal Template Design
Drupal - Introduction to Drupal Template Design
 
160712 wiki lecture
160712 wiki lecture160712 wiki lecture
160712 wiki lecture
 
%&*#! Stupid Puzzles
%&*#! Stupid Puzzles%&*#! Stupid Puzzles
%&*#! Stupid Puzzles
 
Geocaching Puzzle Resources
Geocaching Puzzle ResourcesGeocaching Puzzle Resources
Geocaching Puzzle Resources
 
Basic-CSS-tutorial
Basic-CSS-tutorialBasic-CSS-tutorial
Basic-CSS-tutorial
 
Introduction to ruby
Introduction to rubyIntroduction to ruby
Introduction to ruby
 
Tarea de Geometria Juanpi
Tarea de Geometria JuanpiTarea de Geometria Juanpi
Tarea de Geometria Juanpi
 
Content Strategy for WordPress
Content Strategy for WordPressContent Strategy for WordPress
Content Strategy for WordPress
 
Geb: Abstracting Page Templates
Geb: Abstracting Page TemplatesGeb: Abstracting Page Templates
Geb: Abstracting Page Templates
 
Internet Marketing Institute in Delhi
Internet Marketing Institute in DelhiInternet Marketing Institute in Delhi
Internet Marketing Institute in Delhi
 
css v1 guru
css v1 gurucss v1 guru
css v1 guru
 
Content Strategy for WordPress: Case Study
Content Strategy for WordPress: Case StudyContent Strategy for WordPress: Case Study
Content Strategy for WordPress: Case Study
 
Social Sciences Librarians Boot Camp 2012: Zotero and Mendeley
Social Sciences Librarians Boot Camp 2012: Zotero and MendeleySocial Sciences Librarians Boot Camp 2012: Zotero and Mendeley
Social Sciences Librarians Boot Camp 2012: Zotero and Mendeley
 
Introduction to Browser DOM
Introduction to Browser DOMIntroduction to Browser DOM
Introduction to Browser DOM
 
CSS Learnup for Live Chat
CSS Learnup for Live ChatCSS Learnup for Live Chat
CSS Learnup for Live Chat
 

Viewers also liked

Viewers also liked (15)

Exploring Flexbox with Chris Sauvé
Exploring Flexbox with Chris SauvéExploring Flexbox with Chris Sauvé
Exploring Flexbox with Chris Sauvé
 
a11yTO - Web Accessibility for Developers
a11yTO - Web Accessibility for Developersa11yTO - Web Accessibility for Developers
a11yTO - Web Accessibility for Developers
 
OOCSS in the Real World: A Case Study from the CBC
OOCSS in the Real World: A Case Study from the CBCOOCSS in the Real World: A Case Study from the CBC
OOCSS in the Real World: A Case Study from the CBC
 
OOCSS presentation
OOCSS presentationOOCSS presentation
OOCSS presentation
 
Building & Scaling a Front End Practice & Team
Building & Scaling a Front End Practice & TeamBuilding & Scaling a Front End Practice & Team
Building & Scaling a Front End Practice & Team
 
OOCSS in the Real World: A Case Study from the CBC - Revisited
OOCSS in the Real World: A Case Study from the CBC - RevisitedOOCSS in the Real World: A Case Study from the CBC - Revisited
OOCSS in the Real World: A Case Study from the CBC - Revisited
 
Tech Headline - CSS Naming Conventions: Improve your code with OOCSS, SMACSS,...
Tech Headline - CSS Naming Conventions: Improve your code with OOCSS, SMACSS,...Tech Headline - CSS Naming Conventions: Improve your code with OOCSS, SMACSS,...
Tech Headline - CSS Naming Conventions: Improve your code with OOCSS, SMACSS,...
 
The Cascade, Grids, Headings, and Selectors from an OOCSS Perspective, Ajax ...
The Cascade, Grids, Headings, and Selectors from an OOCSS Perspective,  Ajax ...The Cascade, Grids, Headings, and Selectors from an OOCSS Perspective,  Ajax ...
The Cascade, Grids, Headings, and Selectors from an OOCSS Perspective, Ajax ...
 
Refreshing Your UI with HTML5, Bootstrap and CSS3
Refreshing Your UI with HTML5, Bootstrap and CSS3Refreshing Your UI with HTML5, Bootstrap and CSS3
Refreshing Your UI with HTML5, Bootstrap and CSS3
 
Responsive web-design through bootstrap
Responsive web-design through bootstrapResponsive web-design through bootstrap
Responsive web-design through bootstrap
 
CSS - OOCSS, SMACSS and more
CSS - OOCSS, SMACSS and moreCSS - OOCSS, SMACSS and more
CSS - OOCSS, SMACSS and more
 
Bootstrap ppt
Bootstrap pptBootstrap ppt
Bootstrap ppt
 
Object Oriented CSS
Object Oriented CSSObject Oriented CSS
Object Oriented CSS
 
OOCSS and SMACSS Case Study
OOCSS and SMACSS Case StudyOOCSS and SMACSS Case Study
OOCSS and SMACSS Case Study
 
Introduction to Bootstrap
Introduction to BootstrapIntroduction to Bootstrap
Introduction to Bootstrap
 

Similar to Object Oriented CSS - Joomla!dagen Nederland 2014

Relating to Relational Databases aka Lolibrary 101
Relating to Relational Databases aka Lolibrary 101Relating to Relational Databases aka Lolibrary 101
Relating to Relational Databases aka Lolibrary 101
lolibrary
 
Intro to jQuery for Drupal
Intro to jQuery for DrupalIntro to jQuery for Drupal
Intro to jQuery for Drupal
jhamiltoorion
 
網頁程式設計
網頁程式設計網頁程式設計
網頁程式設計
傳錡 蕭
 
Open Source CMS Playroom
Open Source CMS PlayroomOpen Source CMS Playroom
Open Source CMS Playroom
librarywebchic
 

Similar to Object Oriented CSS - Joomla!dagen Nederland 2014 (20)

Rhetoric and Flexible Content with Drupal
Rhetoric and Flexible Content with DrupalRhetoric and Flexible Content with Drupal
Rhetoric and Flexible Content with Drupal
 
Best SEO Training Institute in North Delhi
Best SEO Training Institute in North DelhiBest SEO Training Institute in North Delhi
Best SEO Training Institute in North Delhi
 
Best Digital Marketing Institute in Rohini
Best Digital Marketing Institute in RohiniBest Digital Marketing Institute in Rohini
Best Digital Marketing Institute in Rohini
 
Web design training , Web Design Training In Kolkata
Web design training , Web Design Training In KolkataWeb design training , Web Design Training In Kolkata
Web design training , Web Design Training In Kolkata
 
What is Modular CSS?
What is Modular CSS?What is Modular CSS?
What is Modular CSS?
 
Functional Immutable CSS
Functional Immutable CSS Functional Immutable CSS
Functional Immutable CSS
 
Relating to Relational Databases aka Lolibrary 101
Relating to Relational Databases aka Lolibrary 101Relating to Relational Databases aka Lolibrary 101
Relating to Relational Databases aka Lolibrary 101
 
DRY CSS A don’t-repeat-yourself methodology for creating efficient, unified a...
DRY CSS A don’t-repeat-yourself methodology for creating efficient, unified a...DRY CSS A don’t-repeat-yourself methodology for creating efficient, unified a...
DRY CSS A don’t-repeat-yourself methodology for creating efficient, unified a...
 
Advanced CSS Troubleshooting
Advanced CSS TroubleshootingAdvanced CSS Troubleshooting
Advanced CSS Troubleshooting
 
Intro to jQuery for Drupal
Intro to jQuery for DrupalIntro to jQuery for Drupal
Intro to jQuery for Drupal
 
Understanding Taxonomy, Drupal Camp Colorado, June 2009
Understanding Taxonomy, Drupal Camp Colorado, June 2009Understanding Taxonomy, Drupal Camp Colorado, June 2009
Understanding Taxonomy, Drupal Camp Colorado, June 2009
 
Rapid Prototyping With jQuery
Rapid Prototyping With jQueryRapid Prototyping With jQuery
Rapid Prototyping With jQuery
 
Drupal In 1 Hour
Drupal In 1 HourDrupal In 1 Hour
Drupal In 1 Hour
 
jQuery for Drupal
jQuery for DrupaljQuery for Drupal
jQuery for Drupal
 
CSS3: Ripe and Ready to Respond
CSS3: Ripe and Ready to RespondCSS3: Ripe and Ready to Respond
CSS3: Ripe and Ready to Respond
 
CSS workshop @ OutSystems
CSS workshop @ OutSystemsCSS workshop @ OutSystems
CSS workshop @ OutSystems
 
網頁程式設計
網頁程式設計網頁程式設計
網頁程式設計
 
Comparison of Top CMS Systems
Comparison of Top CMS SystemsComparison of Top CMS Systems
Comparison of Top CMS Systems
 
Open Source CMS Playroom
Open Source CMS PlayroomOpen Source CMS Playroom
Open Source CMS Playroom
 
Minimalist Theming: How to Build a Lean, Mean Drupal 8 Theme
Minimalist Theming: How to Build a Lean, Mean Drupal 8 ThemeMinimalist Theming: How to Build a Lean, Mean Drupal 8 Theme
Minimalist Theming: How to Build a Lean, Mean Drupal 8 Theme
 

Recently uploaded

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Recently uploaded (20)

How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 

Object Oriented CSS - Joomla!dagen Nederland 2014