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

ISUCON4 予選問題で(中略)、”my.cnf”に1行だけ足して予選通過ラインを突破するの術
ISUCON4 予選問題で(中略)、”my.cnf”に1行だけ足して予選通過ラインを突破するの術ISUCON4 予選問題で(中略)、”my.cnf”に1行だけ足して予選通過ラインを突破するの術
ISUCON4 予選問題で(中略)、”my.cnf”に1行だけ足して予選通過ラインを突破するの術
Masahiro Nagano
 

What's hot (20)

素集合データ構造
素集合データ構造素集合データ構造
素集合データ構造
 
サーバーレスなPCI DSS対応クレジットカード決済基盤システムを運用しながら、みんなでわいわいDIYの精神で、新しいモバイル決済サービス6gramを作っ...
サーバーレスなPCI DSS対応クレジットカード決済基盤システムを運用しながら、みんなでわいわいDIYの精神で、新しいモバイル決済サービス6gramを作っ...サーバーレスなPCI DSS対応クレジットカード決済基盤システムを運用しながら、みんなでわいわいDIYの精神で、新しいモバイル決済サービス6gramを作っ...
サーバーレスなPCI DSS対応クレジットカード決済基盤システムを運用しながら、みんなでわいわいDIYの精神で、新しいモバイル決済サービス6gramを作っ...
 
llvm入門
llvm入門llvm入門
llvm入門
 
フラグを愛でる
フラグを愛でるフラグを愛でる
フラグを愛でる
 
平成生まれのための MINIX 講座
平成生まれのための MINIX 講座平成生まれのための MINIX 講座
平成生まれのための MINIX 講座
 
презентація досвіду
презентація досвідупрезентація досвіду
презентація досвіду
 
Створюємо блог бібліотеки
Створюємо блог бібліотекиСтворюємо блог бібліотеки
Створюємо блог бібліотеки
 
ISUCON4 予選問題で(中略)、”my.cnf”に1行だけ足して予選通過ラインを突破するの術
ISUCON4 予選問題で(中略)、”my.cnf”に1行だけ足して予選通過ラインを突破するの術ISUCON4 予選問題で(中略)、”my.cnf”に1行だけ足して予選通過ラインを突破するの術
ISUCON4 予選問題で(中略)、”my.cnf”に1行だけ足して予選通過ラインを突破するの術
 
Inside WebM
Inside WebMInside WebM
Inside WebM
 
SSL/TLSの基礎と最新動向
SSL/TLSの基礎と最新動向SSL/TLSの基礎と最新動向
SSL/TLSの基礎と最新動向
 
フラッター開発におけるシークレット情報取扱考察
フラッター開発におけるシークレット情報取扱考察フラッター開発におけるシークレット情報取扱考察
フラッター開発におけるシークレット情報取扱考察
 
動的計画法入門(An introduction to Dynamic Programming)
動的計画法入門(An introduction to Dynamic Programming)動的計画法入門(An introduction to Dynamic Programming)
動的計画法入門(An introduction to Dynamic Programming)
 
Smalltalkだめ自慢
Smalltalkだめ自慢Smalltalkだめ自慢
Smalltalkだめ自慢
 
Windows環境でのgitまとめ(2016.8)
Windows環境でのgitまとめ(2016.8)Windows環境でのgitまとめ(2016.8)
Windows環境でのgitまとめ(2016.8)
 
C++の黒魔術
C++の黒魔術C++の黒魔術
C++の黒魔術
 
部内勉強会 数え上げの基礎
部内勉強会 数え上げの基礎部内勉強会 数え上げの基礎
部内勉強会 数え上げの基礎
 
CEDEC2021 ダウンロード時間を大幅減!~大量のアセットをさばく高速な実装と運用事例の共有~
CEDEC2021 ダウンロード時間を大幅減!~大量のアセットをさばく高速な実装と運用事例の共有~ CEDEC2021 ダウンロード時間を大幅減!~大量のアセットをさばく高速な実装と運用事例の共有~
CEDEC2021 ダウンロード時間を大幅減!~大量のアセットをさばく高速な実装と運用事例の共有~
 
Интернетке қосу және браузерлер түрі
Интернетке қосу және браузерлер түріИнтернетке қосу және браузерлер түрі
Интернетке қосу және браузерлер түрі
 
暗認本読書会6
暗認本読書会6暗認本読書会6
暗認本読書会6
 
チケット駆動開発現場の最前線.pdf
チケット駆動開発現場の最前線.pdfチケット駆動開発現場の最前線.pdf
チケット駆動開発現場の最前線.pdf
 

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

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
 

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

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

+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@
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 

Recently uploaded (20)

+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...
 
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...
 
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?
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
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
 
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
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
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
 
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
 
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?
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 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...
 
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
 
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
 
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
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
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...
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 

CSS Systems