SlideShare a Scribd company logo
1 of 10
{
OOCSS con SASS Intro
Sandro Gullà
Twitter: @sandrogulla
Object Oriented CSS
I CSS su grandi siti web nel tempo:
 Crescono
 Vengono modificati in continuazione
 Diventano fragili
 Contengono stili duplicati
 Poco riuso del codice
Nel 2009 Nicole Sullivan introdusse al Web Directions North
una metodologia chiamata OOCSS (Object Oriented CSS).
Per oggetto si intende un pattern visuale che può essere un
blocco HTML, CSS e avvolte JavaScript.
OOCSS - Intro
Principi fondamentali:
 Separazione tra struttura e skin
 Struttura: height, width, padding, float ...
 Skin: background, color ...
 Separazione tra contenitore e content
 I componenti si possono spostare da un contenitore all’altro
mantenendo lo stesso stile. Es: il componente .latest-news si
può spostare in .sidebar o in .main-content mantenendo lo stesso
stile.
Principi Fondamentali
Vantaggi dell’OOCSS:
 Riusabilità
 Performance
 Efficienza
 Scalabilità
 Mantenibilità
Vantaggi dell’OOCSS
Esempio OOCSS
<a href="#" class=“box btn btn-twitter">Twitter</a>
<a href="#" class=“box btn btn-facebook">Facebook</a>
.btn-twitter {
background:red;
}
.btn-facebook {
background:blue;
}
.box{
padding:10px 20px;
}
.btn {
border:3px solid #000;
color:#fff;
border-radius:10px;
}
Linee guida
 Evita di usare selettori senza class
(i.e. .sidebar h3)
 Evita gli ID per stilare direttamente
 Evita di concatenare elementi con classi css
(i.e. div.header o h1.title)
 Eccetto casi rari, evita !important
 Usare CSS Lint per controllare il CSS
 Usare le griglie CSS
Linee Guida
Esempio OOCSS + SASS
<a href="#" class=“box btn-twitter">Twitter</a>
<a href="#" class=“box btn-facebook">Facebook</a>
.btn-twitter {
@extend .btn;
background:red;
}
.btn-facebook {
@extend .btn;
background:blue;
}
.box{
padding: 10px 20px
}
.btn {
border:3px solid #000;
color:#fff;
border-radius:10px;
}
Senza o Con SASS
Riferimenti
 http://www.slideshare.net/stubbornella/object-oriented-css
 http://takazudo.github.io/presentation-oocss-sass/#/
 http://www.smashingmagazine.com/2011/12/12/an-
introduction-to-object-oriented-css-oocss/
 http://appendto.com/2014/04/oocss/
Riferimenti
Grazie !!!
Sandro Gullà
Twitter: @sandrogulla

More Related Content

Featured

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by HubspotMarius Sescu
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTExpeed Software
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsPixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 

Featured (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 

OOCSS con SASS Intro

  • 1. { OOCSS con SASS Intro Sandro Gullà Twitter: @sandrogulla Object Oriented CSS
  • 2. I CSS su grandi siti web nel tempo:  Crescono  Vengono modificati in continuazione  Diventano fragili  Contengono stili duplicati  Poco riuso del codice Nel 2009 Nicole Sullivan introdusse al Web Directions North una metodologia chiamata OOCSS (Object Oriented CSS). Per oggetto si intende un pattern visuale che può essere un blocco HTML, CSS e avvolte JavaScript. OOCSS - Intro
  • 3. Principi fondamentali:  Separazione tra struttura e skin  Struttura: height, width, padding, float ...  Skin: background, color ...  Separazione tra contenitore e content  I componenti si possono spostare da un contenitore all’altro mantenendo lo stesso stile. Es: il componente .latest-news si può spostare in .sidebar o in .main-content mantenendo lo stesso stile. Principi Fondamentali
  • 4. Vantaggi dell’OOCSS:  Riusabilità  Performance  Efficienza  Scalabilità  Mantenibilità Vantaggi dell’OOCSS
  • 5. Esempio OOCSS <a href="#" class=“box btn btn-twitter">Twitter</a> <a href="#" class=“box btn btn-facebook">Facebook</a> .btn-twitter { background:red; } .btn-facebook { background:blue; } .box{ padding:10px 20px; } .btn { border:3px solid #000; color:#fff; border-radius:10px; }
  • 6. Linee guida  Evita di usare selettori senza class (i.e. .sidebar h3)  Evita gli ID per stilare direttamente  Evita di concatenare elementi con classi css (i.e. div.header o h1.title)  Eccetto casi rari, evita !important  Usare CSS Lint per controllare il CSS  Usare le griglie CSS Linee Guida
  • 7. Esempio OOCSS + SASS <a href="#" class=“box btn-twitter">Twitter</a> <a href="#" class=“box btn-facebook">Facebook</a> .btn-twitter { @extend .btn; background:red; } .btn-facebook { @extend .btn; background:blue; } .box{ padding: 10px 20px } .btn { border:3px solid #000; color:#fff; border-radius:10px; }
  • 8. Senza o Con SASS
  • 9. Riferimenti  http://www.slideshare.net/stubbornella/object-oriented-css  http://takazudo.github.io/presentation-oocss-sass/#/  http://www.smashingmagazine.com/2011/12/12/an- introduction-to-object-oriented-css-oocss/  http://appendto.com/2014/04/oocss/ Riferimenti