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 speciļ¬city,

  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
   notiļ¬cations 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
   notiļ¬cations 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 speciļ¬c 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 ļ¬xed?


                     27
MAINTAINABLE LAYOUT


if you are using an em or ļ¬xed 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 ļ¬‚oat
                   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 ļ¬xed;




                                                        54
background: lime;




                    55
background: url(quot;roļ¬‚.gifquot;);




                              56
background-color: lime;


background-image: url(quot;roļ¬‚.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
ļ¬‚oating


          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 ļ¬les 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



deļ¬ne it
develop it
maintain it
communicate it
                           76
THANK YOU




            77
?   78

More Related Content

What's hot

Introduction to css
Introduction to cssIntroduction to css
Introduction to css
eShikshak
Ā 
Introduction to HTML and CSS
Introduction to HTML and CSSIntroduction to HTML and CSS
Introduction to HTML and CSS
Ferdous Mahmud Shaon
Ā 
Basic-CSS-tutorial
Basic-CSS-tutorialBasic-CSS-tutorial
Basic-CSS-tutorial
tutorialsruby
Ā 

What's hot (20)

JavaScript
JavaScriptJavaScript
JavaScript
Ā 
Advanced Cascading Style Sheets
Advanced Cascading Style SheetsAdvanced Cascading Style Sheets
Advanced Cascading Style Sheets
Ā 
Bootstrap PPT by Mukesh
Bootstrap PPT by MukeshBootstrap PPT by Mukesh
Bootstrap PPT by Mukesh
Ā 
Javascript Basic
Javascript BasicJavascript Basic
Javascript Basic
Ā 
Bootstrap grids
Bootstrap gridsBootstrap grids
Bootstrap grids
Ā 
Introduction to css
Introduction to cssIntroduction to css
Introduction to css
Ā 
Introduction to HTML and CSS
Introduction to HTML and CSSIntroduction to HTML and CSS
Introduction to HTML and CSS
Ā 
Bootstrap - Basics
Bootstrap - BasicsBootstrap - Basics
Bootstrap - Basics
Ā 
CSS Positioning and Features of CSS3
CSS Positioning and Features of CSS3CSS Positioning and Features of CSS3
CSS Positioning and Features of CSS3
Ā 
Bootstrap 5 ppt
Bootstrap 5 pptBootstrap 5 ppt
Bootstrap 5 ppt
Ā 
An Overview of HTML, CSS & Java Script
An Overview of HTML, CSS & Java ScriptAn Overview of HTML, CSS & Java Script
An Overview of HTML, CSS & Java Script
Ā 
Efficient, maintainable CSS
Efficient, maintainable CSSEfficient, maintainable CSS
Efficient, maintainable CSS
Ā 
CSS
CSSCSS
CSS
Ā 
Basic-CSS-tutorial
Basic-CSS-tutorialBasic-CSS-tutorial
Basic-CSS-tutorial
Ā 
Web Assembly Big Picture
Web Assembly Big PictureWeb Assembly Big Picture
Web Assembly Big Picture
Ā 
HTML
HTMLHTML
HTML
Ā 
Css
CssCss
Css
Ā 
Css Specificity
Css SpecificityCss Specificity
Css Specificity
Ā 
django
djangodjango
django
Ā 
WordPress Theme Development
 WordPress Theme Development WordPress Theme Development
WordPress Theme Development
Ā 

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)

Atomic design
Atomic designAtomic design
Atomic design
Ā 
Object Oriented CSS
Object Oriented CSSObject Oriented CSS
Object Oriented CSS
Ā 
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
Ā 
Sass compass
Sass compassSass compass
Sass compass
Nick Cooley
Ā 
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

What I Did Holidays
What I Did HolidaysWhat I Did Holidays
What I Did Holidays
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

Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
Ā 

Recently uploaded (20)

Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
Ā 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Ā 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
Ā 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
Ā 
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
Ā 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
Ā 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Ā 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
Ā 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
Ā 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
Ā 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
Ā 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
Ā 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
Ā 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
Ā 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
Ā 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Ā 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Ā 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Ā 
Mcleodganj Call Girls šŸ„° 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls šŸ„° 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls šŸ„° 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls šŸ„° 8617370543 Service Offer VIP Hot Model
Ā 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Ā 

CSS Systems