SlideShare a Scribd company logo
1 of 78
Download to read offline
WRITING MAINTAINABLE CSS
Natalie Downe | Barcamp London 5




                                   28th September 2008
                                                         1
WRITING MAINTAINABLE CSS
Natalie Downe | Barcamp London 5




                                   28th September 2008
                                                         2
CSS SYSTEMS
Natalie Downe | Barcamp London 5




                                   28th September 2008
                                                         3
I am an optimist


                   4
so I am going to
  assume that


                   5
you already write beautiful and valid markup
                                               6
you use semantic markup & class / id names
                                             7
you separate content, presentation & behavior
                                                8
because you care


                   9
Maintainability in CSS?


                          10
It’s not a solved
     problem.


                    11
It’s not just about
     the future


                      12
It’s about now


                 13
CLEARLEFT

High quality code
To tight deadlines
For handover to external developers




                                      14
CSS SYSTEMS

              15
A CSS SYSTEM IS...

a top down approach

personalised for an individual site

a reusable set of markup patterns and CSS

looking at the overall stucture and individual
components

glossary of shared vocabulary for developers



                                                 16
ORDERING

Rule blocks are loosely ordered by specificity,

  Elements, grouped by type of tag

  Classes, grouped by the effect they create

  IDs, grouped by the component they affect




                                                 17
GROUPING

general styles
   body styles
   reset
   links
   headings
   other elements, tags
helper styles
   forms
   notifications and errors
   consistant items with normally just one class
page structure
   skeleton including page furniture,
page components
   most of your styles will be in here
overrides



                                                   18
GROUPING

general styles
   body styles
   reset
   links
   headings
   other elements, tags
helper styles
   forms
   notifications and errors
   consistant items with normally just one class
page structure
   skeleton including page furniture,
page components
   most of your styles will be in here
overrides



                                                   19
CSS Edit
macrabbit.com/cssedit

                        20
CSS Edit
macrabbit.com/cssedit

                        21
CONDITIONAL COMMENTS

Never use browser hacks

Browser specific stylesheets for all versions of IE and
another for IE6 and under

If you have to entirely re-engineer for IE, overriding
your standards ready CSS in a conditional comment,
you’re Doing It Wrong




                                                         22
please look
  to my right
for a moment


                23
please look
  to my right
for a moment




                24
BEFORE YOU START
  So I have a design ... what now?

                                     25
look at the basics


                     26
will it be liquid?
elastic? or fixed?


                     27
MAINTAINABLE LAYOUT


if you are using an em or fixed width layout, try to only
set a width on the container, using percentages
inside

a max-width of 100% will stop your layout creeping
out the side of the viewport

up and down font size all the time

be afraid of heights, vertigo is healthy on the web.
NEVER use height in px on anything with text inside

                                                           28
29
the grid


           30
draw diagrams
                31
lots of diagrams
                   32
make calculations
                    33
get inventive
                34
levels of headings


                     35
36
page structure
and components


                  37
38
39
40
MAINTAINABILITY MYTHS
  Any existing ‘best practices’ or approaches?

                                                 41
CSS frameworks
                 42
Single line declaration blocks
                                 43
Selector based indentation
                             44
colour.css / layout.css / typography.css
                                           45
ON YOUR MARKS ...
You have your design and your plan - you’re all set!

                                                       46
use the cascade
                  47
div#page div.teaser ul.products li p.name




                                            48
ul.products p.name




                     49
you love to float
                   50
shorthand?
             51
p { font: 12px/14px sans-serif }
p { font: 80% sans-serif }
p { font: x-large/110% quot;New Century Schoolbookquot;, serif }
p { font: bold italic large Palatino, serif }
p { font: normal small-caps 120%/120% fantasy }




                                                           52
53
background: url(quot;w00t.pngquot;) orange 0 50% repeat fixed;




                                                        54
background: lime;




                    55
background: url(quot;rofl.gifquot;);




                              56
background-color: lime;


background-image: url(quot;rofl.pngquot;);




                                    57
PREPARE FOR THE WORST
  n00bs will one day be let loose on your code
                   (accept it)
                                                 58
clear your footer


                    59
careful with
dimensions


               60
watch your height


                    61
hooks


        62
editable content


                   63
sanitise text


                64
abstract your icons


                      65
DESIGN TO AVOID DEBUGGING
     engineer your way around the browser

                                            66
Simultaneously develop
                         67
dont re-engineer
seperate solutions


                     68
floating


          69
you need to set
psuedo selectors on
       links

                      70
buttons


          71
review


         72
HANDOVER
what to give the client

                          73
THE IDEAL HANDOVER INCLUDES


The markup scheme, a set of files demonstrating
the different markup components

The CSS itself

Supporting documents that explain the system as
clearly as possible

A face to face meeting if possible



                                                  74
FINALLY




          75
ITS ALL ABOUT THE SYSTEM



define it
develop it
maintain it
communicate it
                           76
THANK YOU




            77
?   78

More Related Content

What's hot

2 TomcatによるWebアプリケーションサーバ構築 第4章 Tomcatの構成(1)-仮想ホスト、Apache連携
2 TomcatによるWebアプリケーションサーバ構築 第4章 Tomcatの構成(1)-仮想ホスト、Apache連携2 TomcatによるWebアプリケーションサーバ構築 第4章 Tomcatの構成(1)-仮想ホスト、Apache連携
2 TomcatによるWebアプリケーションサーバ構築 第4章 Tomcatの構成(1)-仮想ホスト、Apache連携
Enpel
 
1 03 - CSS Introduction
1 03 - CSS Introduction1 03 - CSS Introduction
1 03 - CSS Introduction
apnwebdev
 
MongoDB- Crud Operation
MongoDB- Crud OperationMongoDB- Crud Operation
MongoDB- Crud Operation
Edureka!
 

What's hot (20)

2 TomcatによるWebアプリケーションサーバ構築 第4章 Tomcatの構成(1)-仮想ホスト、Apache連携
2 TomcatによるWebアプリケーションサーバ構築 第4章 Tomcatの構成(1)-仮想ホスト、Apache連携2 TomcatによるWebアプリケーションサーバ構築 第4章 Tomcatの構成(1)-仮想ホスト、Apache連携
2 TomcatによるWebアプリケーションサーバ構築 第4章 Tomcatの構成(1)-仮想ホスト、Apache連携
 
Building Advanced XSS Vectors
Building Advanced XSS VectorsBuilding Advanced XSS Vectors
Building Advanced XSS Vectors
 
Deep understanding on Cross-Site Scripting and SQL Injection
Deep understanding on Cross-Site Scripting and SQL InjectionDeep understanding on Cross-Site Scripting and SQL Injection
Deep understanding on Cross-Site Scripting and SQL Injection
 
What is Object Oriented CSS?
What is Object Oriented CSS?What is Object Oriented CSS?
What is Object Oriented CSS?
 
0x08-CSS-flexbox.pdf
0x08-CSS-flexbox.pdf0x08-CSS-flexbox.pdf
0x08-CSS-flexbox.pdf
 
Accediendo a una base de datos de MySQL con Entity Framework Core desde ASP ....
Accediendo a una base de datos de MySQL con Entity Framework Core desde ASP ....Accediendo a una base de datos de MySQL con Entity Framework Core desde ASP ....
Accediendo a una base de datos de MySQL con Entity Framework Core desde ASP ....
 
XSS- an application security vulnerability
XSS-   an application security vulnerabilityXSS-   an application security vulnerability
XSS- an application security vulnerability
 
Bootstrap 3
Bootstrap 3Bootstrap 3
Bootstrap 3
 
Cross-Site Scripting (XSS)
Cross-Site Scripting (XSS)Cross-Site Scripting (XSS)
Cross-Site Scripting (XSS)
 
Responsive Web Design Tutorial PDF for Beginners
Responsive Web Design Tutorial PDF for BeginnersResponsive Web Design Tutorial PDF for Beginners
Responsive Web Design Tutorial PDF for Beginners
 
1 03 - CSS Introduction
1 03 - CSS Introduction1 03 - CSS Introduction
1 03 - CSS Introduction
 
MongoDB- Crud Operation
MongoDB- Crud OperationMongoDB- Crud Operation
MongoDB- Crud Operation
 
Cross Site Scripting Defense Presentation
Cross Site Scripting Defense Presentation Cross Site Scripting Defense Presentation
Cross Site Scripting Defense Presentation
 
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...
 
Introduction to Cascading Style Sheets (CSS)
Introduction to Cascading Style Sheets (CSS)Introduction to Cascading Style Sheets (CSS)
Introduction to Cascading Style Sheets (CSS)
 
ZeroNights 2018 | I <"3 XSS
ZeroNights 2018 | I <"3 XSSZeroNights 2018 | I <"3 XSS
ZeroNights 2018 | I <"3 XSS
 
Owasp Top 10 A1: Injection
Owasp Top 10 A1: InjectionOwasp Top 10 A1: Injection
Owasp Top 10 A1: Injection
 
Intro to html, css & sass
Intro to html, css & sassIntro to html, css & sass
Intro to html, css & sass
 
Object Oriented CSS
Object Oriented CSSObject Oriented CSS
Object Oriented CSS
 
Unrestricted file upload CWE-434 - Adam Nurudini (ISACA)
Unrestricted file upload CWE-434 -  Adam Nurudini (ISACA)Unrestricted file upload CWE-434 -  Adam Nurudini (ISACA)
Unrestricted file upload CWE-434 - Adam Nurudini (ISACA)
 

Viewers also liked

OSCON 2013 - The Hitchiker’s Guide to Open Source Cloud Computing
OSCON 2013 - The Hitchiker’s Guide to Open Source Cloud ComputingOSCON 2013 - The Hitchiker’s Guide to Open Source Cloud Computing
OSCON 2013 - The Hitchiker’s Guide to Open Source Cloud Computing
Mark Hinkle
 
Basic Transport & Fleet Mngt - AK2015
Basic Transport & Fleet Mngt - AK2015Basic Transport & Fleet Mngt - AK2015
Basic Transport & Fleet Mngt - AK2015
Andre Knipe
 

Viewers also liked (20)

Efficient, maintainable CSS
Efficient, maintainable CSSEfficient, maintainable CSS
Efficient, maintainable CSS
 
Atomic design
Atomic designAtomic design
Atomic design
 
The Great State of Design with CSS Grid Layout and Friends
The Great State of Design with CSS Grid Layout and FriendsThe Great State of Design with CSS Grid Layout and Friends
The Great State of Design with CSS Grid Layout and Friends
 
Looking for Patterns
Looking for PatternsLooking for Patterns
Looking for Patterns
 
Interruption Timer Périodique
Interruption Timer PériodiqueInterruption Timer Périodique
Interruption Timer Périodique
 
OSCON 2013 - The Hitchiker’s Guide to Open Source Cloud Computing
OSCON 2013 - The Hitchiker’s Guide to Open Source Cloud ComputingOSCON 2013 - The Hitchiker’s Guide to Open Source Cloud Computing
OSCON 2013 - The Hitchiker’s Guide to Open Source Cloud Computing
 
Maintainable CSS
Maintainable CSSMaintainable CSS
Maintainable CSS
 
Crafting Front-End Style Guides
Crafting Front-End Style GuidesCrafting Front-End Style Guides
Crafting Front-End Style Guides
 
HTML/CSS Crash Course (april 4 2017)
HTML/CSS Crash Course (april 4 2017)HTML/CSS Crash Course (april 4 2017)
HTML/CSS Crash Course (april 4 2017)
 
CSS3 Introduction
CSS3 IntroductionCSS3 Introduction
CSS3 Introduction
 
Fleet & transport policy - Envision International (Conf 2010)
Fleet & transport policy - Envision International (Conf 2010)Fleet & transport policy - Envision International (Conf 2010)
Fleet & transport policy - Envision International (Conf 2010)
 
Curso de cascading style sheets (css)
Curso de cascading style sheets (css)Curso de cascading style sheets (css)
Curso de cascading style sheets (css)
 
Css(cascading style sheets)
Css(cascading style sheets)Css(cascading style sheets)
Css(cascading style sheets)
 
Cascading Style Sheets (CSS) - An introduction
Cascading Style Sheets (CSS) - An introductionCascading Style Sheets (CSS) - An introduction
Cascading Style Sheets (CSS) - An introduction
 
Css best practices style guide and tips
Css best practices style guide and tipsCss best practices style guide and tips
Css best practices style guide and tips
 
Basic Transport & Fleet Mngt - AK2015
Basic Transport & Fleet Mngt - AK2015Basic Transport & Fleet Mngt - AK2015
Basic Transport & Fleet Mngt - AK2015
 
Vehicle Management Software
Vehicle Management SoftwareVehicle Management Software
Vehicle Management Software
 
Fasten RWD Development with Sass
Fasten RWD Development with SassFasten RWD Development with Sass
Fasten RWD Development with Sass
 
Introduction to CSS3
Introduction to CSS3Introduction to CSS3
Introduction to CSS3
 
6 Steps to Make Your CSS Code More Maintainable
6 Steps to Make Your CSS Code More Maintainable6 Steps to Make Your CSS Code More Maintainable
6 Steps to Make Your CSS Code More Maintainable
 

Similar to CSS Systems

Drupal Theming with CSS Frameworks (960grid)
Drupal Theming with CSS Frameworks (960grid)Drupal Theming with CSS Frameworks (960grid)
Drupal Theming with CSS Frameworks (960grid)
Ryan Cross
 
Compass And Sass(Tim Riley)
Compass And Sass(Tim Riley)Compass And Sass(Tim Riley)
Compass And Sass(Tim Riley)
elliando dias
 
How to develop a CSS Framework
How to develop a CSS FrameworkHow to develop a CSS Framework
How to develop a CSS Framework
Olivier Besson
 
Object oriented css. Graeme Blackwood
Object oriented css. Graeme BlackwoodObject oriented css. Graeme Blackwood
Object oriented css. Graeme Blackwood
PVasili
 
Object oriented css graeme blackwood
Object oriented css graeme blackwoodObject oriented css graeme blackwood
Object oriented css graeme blackwood
drupalconf
 

Similar to CSS Systems (20)

Drupal Theming with CSS Frameworks (960grid)
Drupal Theming with CSS Frameworks (960grid)Drupal Theming with CSS Frameworks (960grid)
Drupal Theming with CSS Frameworks (960grid)
 
実践!CSSデザインの「型」でみる視覚表現テクニック
実践!CSSデザインの「型」でみる視覚表現テクニック実践!CSSデザインの「型」でみる視覚表現テクニック
実践!CSSデザインの「型」でみる視覚表現テクニック
 
CSS3: Ripe and Ready to Respond
CSS3: Ripe and Ready to RespondCSS3: Ripe and Ready to Respond
CSS3: Ripe and Ready to Respond
 
Simply Responsive CSS3
Simply Responsive CSS3Simply Responsive CSS3
Simply Responsive CSS3
 
Creating a Business Oriented UI in APEX
Creating a Business Oriented UI in APEXCreating a Business Oriented UI in APEX
Creating a Business Oriented UI in APEX
 
An Introduction to CSS Frameworks
An Introduction to CSS FrameworksAn Introduction to CSS Frameworks
An Introduction to CSS Frameworks
 
Intro to CSS3
Intro to CSS3Intro to CSS3
Intro to CSS3
 
Sass compass
Sass compassSass compass
Sass compass
 
PSD to Theme: The SMACSS Way
PSD to Theme: The SMACSS WayPSD to Theme: The SMACSS Way
PSD to Theme: The SMACSS Way
 
Compass And Sass(Tim Riley)
Compass And Sass(Tim Riley)Compass And Sass(Tim Riley)
Compass And Sass(Tim Riley)
 
Advanced CSS Troubleshooting
Advanced CSS TroubleshootingAdvanced CSS Troubleshooting
Advanced CSS Troubleshooting
 
CSS3: Ripe and Ready
CSS3: Ripe and ReadyCSS3: Ripe and Ready
CSS3: Ripe and Ready
 
HTML CSS & Javascript
HTML CSS & JavascriptHTML CSS & Javascript
HTML CSS & Javascript
 
Structure Your SASS BADcamp 2013
Structure Your SASS   BADcamp 2013Structure Your SASS   BADcamp 2013
Structure Your SASS BADcamp 2013
 
Css framework
Css frameworkCss framework
Css framework
 
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
 
Object oriented css. Graeme Blackwood
Object oriented css. Graeme BlackwoodObject oriented css. Graeme Blackwood
Object oriented css. Graeme Blackwood
 
The World of Stylesheet Languages
The World of Stylesheet LanguagesThe World of Stylesheet Languages
The World of Stylesheet Languages
 
Object oriented css graeme blackwood
Object oriented css graeme blackwoodObject oriented css graeme blackwood
Object oriented css graeme blackwood
 

More from Natalie Downe

More from Natalie Downe (7)

From Idea to Exit, the story of our startup
From Idea to Exit, the story of our startupFrom Idea to Exit, the story of our startup
From Idea to Exit, the story of our startup
 
From idea to exit
From idea to exitFrom idea to exit
From idea to exit
 
Becoming Accidental Entrepreneurs
Becoming Accidental Entrepreneurs Becoming Accidental Entrepreneurs
Becoming Accidental Entrepreneurs
 
Serendipity and Lanyrd
Serendipity and LanyrdSerendipity and Lanyrd
Serendipity and Lanyrd
 
Practical Maintainable CSS (short version)
Practical Maintainable CSS (short version)Practical Maintainable CSS (short version)
Practical Maintainable CSS (short version)
 
What I learned from making things
What I learned from making thingsWhat I learned from making things
What I learned from making things
 
What I Did Holidays
What I Did HolidaysWhat I Did Holidays
What I Did Holidays
 

Recently uploaded

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Recently uploaded (20)

The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
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
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
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
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
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...
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
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
 
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...
 
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 🐘
 

CSS Systems