SlideShare ist ein Scribd-Unternehmen logo
1 von 78
Downloaden Sie, um offline zu lesen
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

Weitere ähnliche Inhalte

Was ist angesagt?

Was ist angesagt? (20)

Introduction to sass
Introduction to sassIntroduction to sass
Introduction to sass
 
Efficient, maintainable CSS
Efficient, maintainable CSSEfficient, maintainable CSS
Efficient, maintainable CSS
 
Style and Selector
Style and SelectorStyle and Selector
Style and Selector
 
Css
CssCss
Css
 
CSS for Beginners
CSS for BeginnersCSS for Beginners
CSS for Beginners
 
Basic Html Notes
Basic Html NotesBasic Html Notes
Basic Html Notes
 
CSS For Backend Developers
CSS For Backend DevelopersCSS For Backend Developers
CSS For Backend Developers
 
9- Learn CSS Fundamentals / Pseudo-classes
9- Learn CSS Fundamentals / Pseudo-classes9- Learn CSS Fundamentals / Pseudo-classes
9- Learn CSS Fundamentals / Pseudo-classes
 
Intro to css & sass
Intro to css & sassIntro to css & sass
Intro to css & sass
 
Tailwind: The Future of CSS is Here!
Tailwind: The Future of CSS is Here!Tailwind: The Future of CSS is Here!
Tailwind: The Future of CSS is Here!
 
BEM it! Introduction to BEM methodology
BEM it! Introduction to BEM methodologyBEM it! Introduction to BEM methodology
BEM it! Introduction to BEM methodology
 
Introduction to Tailwind CSS - IM Tech Meetup - May 2022.pptx
Introduction to Tailwind CSS - IM Tech Meetup - May 2022.pptxIntroduction to Tailwind CSS - IM Tech Meetup - May 2022.pptx
Introduction to Tailwind CSS - IM Tech Meetup - May 2022.pptx
 
CSS Day: CSS Grid Layout
CSS Day: CSS Grid Layout CSS Day: CSS Grid Layout
CSS Day: CSS Grid Layout
 
CSS Best practice
CSS Best practiceCSS Best practice
CSS Best practice
 
CSS
CSSCSS
CSS
 
Css padding
Css paddingCss padding
Css padding
 
HTML tables- rowspan n colspan
HTML tables- rowspan n colspanHTML tables- rowspan n colspan
HTML tables- rowspan n colspan
 
Html 5
Html 5Html 5
Html 5
 
Learn BEM: CSS Naming Convention
Learn BEM: CSS Naming ConventionLearn BEM: CSS Naming Convention
Learn BEM: CSS Naming Convention
 
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
 

Andere mochten auch

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
 

Andere mochten auch (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
 
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
 
Building a game with JavaScript (March 2017, washington dc)
Building a game with JavaScript (March 2017, washington dc)Building a game with JavaScript (March 2017, washington dc)
Building a game with JavaScript (March 2017, washington dc)
 

Ähnlich wie 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
 

Ähnlich wie 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
 
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
 
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
 

Mehr von Natalie Downe

Mehr von 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
 

Kürzlich hochgeladen

EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
Earley Information Science
 

Kürzlich hochgeladen (20)

How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
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
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
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...
 
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
 
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...
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
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
 
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
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
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
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
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
 

CSS Systems