SlideShare a Scribd company logo
1 of 169
Download to read offline
CSS
oocss, smacss & more...
whatā€™s wro
          ng with

         CSS
ā€œ
CSS is simple... Itā€™s simple to
understand. But CSS is not
simple to use or maintain.




                                                                                 ā€
         http://chriseppstein.github.com/blog/2009/09/20/why-stylesheet-abstraction-matters/
Issues
If youā€™ve ever worked on a
medium to large website, you
have probably come across a
range of issues with CSS.
Repetition
Lots of ļ¬‚oats, font-size
references, heading levels
repeated...
Unmanageable
It may have started out well, but it
has become a mess?
Weight war
You need to add some CSS - so
you have to start adding to
selectors in order to win.
Coupling
Your CSS is speciļ¬cally tied to
HTML or location...
CSS sucks!
Developers have been telling us
for years that ā€œCSS sucksā€. We
all know itā€™s time for our CSS
practices to evolve.
New stuff!
Luckily, there are a wide range of
exciting new developments to
explore.
Biases aside...
Before we start... put aside any
biases. At least until after the
presentation, when you can rip
into me :)
ss
 oc oriented css
o object
What is OOCSS?
In 2009, Nicole
Sullivan introduced a
new way of looking
at CSS. She deļ¬ned
this as Object
Oriented CSS
(OOCSS).
Statistics
After optimising Facebookā€™s CSS,
she discovered some amazing
statistics... about how we reapply
CSS properties throughout our
style sheets.
Facebook:
Facebook blue      261
 Unique colors     548
        colors   6,498

  Salesforce:
      padding    3,668
        h1-h6      511
ā€œ
ā€œWe have been doing it all
wrong.... Our best practices are
killing usā€




                                       ā€
                                   Nicole Sullivan
ā€œ
The purpose of OOCSS is to
encourage code reuse and,
ultimately, faster and more
efficient stylesheets that are
easier to add to and maintain.



                                                                                     ā€
     http://coding.smashingmagazine.com/2011/12/12/an-introduction-to-object-oriented-css-oocss/
Looking for patterns -
        rows
Abstraction
One of the key aims of OOCSS
is to abstract as many
components of the layout as
possible.
Example
Can you see any repeating visual
patterns?
Rows
The ļ¬rst layout pattern could be
the rows.
row



row




row



row
row



row




row




row
Past practice
In the past, people may have
styled these rows using a series
of IDs.
#header



#main




#news




#footer
OOCSS aims
1. use a single class so that it can
be reused as needed
2. abstract the module down to
core purposes
Core purposes
These rows have two purposes:
1. clear each row
2. trigger the block formatting
context.
.row



.row




.row




.row
Re-use
Then we can write one simple,
but very powerful class that can
be reused anywhere in the layout.
.row {
!   clear: left;          Clears each row

!   overflow: hidden;     Triggers block formatting

!   zoom: 1;              Triggers haslayout in IE5-7

!   _overflow: visible;   IE6 underscore hack

}
Different rows
Different rows
Did you notice that two of the
rows were different? They have
different background colours and
additional padding above and
below.
New names?
We could now add some classes
based on the purpose of these
rows - such as ā€œnewsā€ and
ā€œfooterā€.
.news {
!   padding: 1em 0;
!   background-color: blue;!
}

.footer {
!   padding: 1em 0;
!   background-color: pink;!
}
Abstract
However, it would be better to
abstract these names further so
that they are more ļ¬‚exible.
.row   {
!      clear: left;
!      overflow: hidden;
!      zoom: 1;
!      _overflow: visible;
}

.row-alt1 {
!    padding: 1em 0;
!    background-color: blue;!
}

.row-alt2 {
!    padding: 1em 0;
!    background-color: pink;!
}
<div   class="row"></div>
<div   class="row"></div>
<div   class="row row-alt1"></div>
<div   class="row row-alt2"></div>
Further
If you wanted, these could be
abstracted even further into
padding and backgrounds as
separate concepts.
.row-padding {
!   padding: 1em 0;
}

.bg-color1 {
!   background-color: blue;!
}

.bg-color2 {
!   background-color: pink;!
}
<div class="row"></div>
<div class="row"></div>
<div class="row row-padding
bg-color1"></div>
<div class="row row-padding
bg-color2"></div>
Up to you
It depends on the site and
circumstances as to how far you
think you need to abstract these
concepts.
The row module
Primary module
The ā€œrowā€ class is our primary
module. The additional classes
are ā€œmodiļ¬ersā€ as they modify
the primary class.
Modifiers
Modiļ¬ers should not rewrite any
aspect of the primary module,
they only modify or add to the
primary module.
Types of class
Primary module Sub-module   Modiļ¬er
.row-alt1                   .row-alt1
Looking for patterns -
      columns
Columns
The second layout pattern could
be the columns. The wide layout
looks like it has four columns.
Column 1   Column 2   Column 3   Column 4
Patterns
Some of the rows spread across
all columns. Others spread
across two or one column.
Column 1     Column 2   Column 3    Column 4

4 columns



2 columns               2 columns




2 columns               2 columns



1 columns   1 columns   1 columns   1 columns
Framework 1
To be safe, we should assume we
need containers for 4, 3, 2 and 1
column widths. We can convert
these column options into a
simple grid framework.
Wide layout    Class names
4 column box   .w-4col
3 column box   .w-3col
2 column box   .w-2col
1 column box   .w-1col
<div class="row">
!    <div class="w-4col"></div>
</div>
<div class="row">
!    <div class="w-2col"></div>
!    <div class="w-2col"></div>
</div>
<div class="row row-alt1">
!    <div class="w-2col"></div>
!    <div class="w-2col"></div>
</div>
<div class="row row-alt2">
!    <div class="w-1col"></div>
!    <div class="w-1col"></div>
!    <div class="w-1col"></div>
!    <div class="w-1col"></div>
</div>
Narrow
The same is true of the narrow
layout, except this time it has
only two overall columns.
Column 1   Column 2
2 columns


1 columns   1 columns




1 columns   1 columns




1 columns   1 columns
Framework 2
We could also create a second,
different grid for narrow screen.
This would allow us to control
whether columns sat beside each
other or below at a narrower
screen size.
Narrow layout   Class names
2 column box    .n-2col
1 column box    .n-2col
<div class="row">
!    <div class="w-4col"></div>
</div>
<div class="row">
!    <div class="w-2col n-2col"></div>
!    <div class="w-2col n-2col"></div>
</div>
<div class="row row-alt1">
!    <div class="w-2col n-2col"></div>
!    <div class="w-2col n-2col"></div>
</div>
<div class="row row-alt2">
!    <div class="w-1col n-2col"></div>
!    <div class="w-1col n-2col"></div>
!    <div class="w-1col n-2col"></div>
!    <div class="w-1col n-2col"></div>
</div>
Control!
With these two simple grids, we
can control complicated layouts -
both wide and narrow.
Looking for patterns -
       boxes
Boxes?
You may have noticed that there
were also a series of smaller
boxes, each with an image to the
left or right.
Core purpose
1. contain content
2. feature object to left or right
3. content beside feature object
4. margin below
Adaptable box
We need to create an adaptable box:
- could be placed anywhere
- any width or height
- any feature content
- feature content could be left/right
- any content inside the body
Target
We need to be able to target
- the overall box
- the object (left or right)
- the body content within the box
- a possible heading (h1-h6)
- possibly even the contents itself
box
                     box body
                    This is a heading heading
                                   box
      box feature
                    Lorem ipsum dolor sit amet consect etuer
                    adipi scing elit sed diam nonummy nibh
                                                box content
                    euismod tinunt ut laoreet dolore magna
                    aliquam erat volut.
There are a range of possible
 class we could use here.

.box { }
.box-feature { }
.box-feature-alt { }
.box-body { }
.box-heading { }
.box-content { }
Width
Do not give the box a width -
allow it to spread to ļ¬t the width
of any parent container.
Contain floats
This box module must contain
(and therefore wrap around)
either a left or right ļ¬‚oating
object. We can solve this by
triggering the block formatting
context on the parent.
.box {
!   overflow: hidden;     Triggers block formatting

!   zoom: 1;
!   _overflow: visible;
!   margin-bottom: 1em;
}
Location Agnostic
 The box must work when placed
 anywhere within the layout. The
 box must be ā€œlocation agnosticā€.


aside .box { }
.box { }
Sit beside
The box may contain objects that
have varying widths. We need our
content box (ā€œbox-bodyā€) to sit
beside these objects, regardless
of their widths.
BFC again
We can solve this by triggering
the block formatting context on
the ā€œbox-bodyā€ class.
box-body
This is a heading
Lorem ipsum dolor sit amet consect etuer
adipi scing elit sed diam nonummy nibh
euismod tinunt ut laoreet dolore magna
aliquam erat volut.
.box-body {
!   overflow: hidden;     Triggers block formatting

!   zoom: 1;
!   _overflow: visible;
}
The box module
Powerful box
We have just made a very
powerful box. Nicole Sullivan
refers to this box as the ā€œmediaā€
element.
.box,.box-body {
!    overflow: hidden;
!    zoom: 1;
!    _overflow: visible;
}

.box { margin: 0 0 10px; }

.box-feature {
!    float: left;
!    margin: 0 10px 0 0;
}

.box-feature-alt {
!    float: right;
!    margin: 0 0 0 10px;
}
Primary module
In this case, the ā€œboxā€ class is
our primary module. There are no
modiļ¬ers, but there are a range of
sub-modules.
Sub-modules
Sub-modules are other classes
associated with the primary
module. They do not alter or add
directly to the primary module.
Types of class
Primary module Sub-module    Modiļ¬er
.row-alt1                    .row-alt1
.box          .box-feature
              .box-body
Moving forward
Semantic classes
For years, we have been taught
to keep our markup clean and
only use ā€œsemanticā€ class names.
Break the rules?
OOCSS seems to break both of
these rules - and in a big way.
But have we been thinking about
ā€œsemanticā€ class names in the
wrong way?
ā€œ
HTML class names offer no
semantic value to search engines
or screen readers, aside from
microformats.




                                                                                          ā€
    http://www.brettjankord.com/2013/02/09/thoughts-on-semantic-html-class-names-and-maintainability/
ā€œ
Rather than concerning
ourselves with creating semantic
class names, I think we should be
thinking about creating sensible
class names. Sensible class
names offer semantics, but they


                                                                                          ā€
also offer flexibility/reusability.
    http://www.brettjankord.com/2013/02/09/thoughts-on-semantic-html-class-names-and-maintainability/
ā€œ
If your class is called ā€œblueā€ and
you want to change it to red, you
have far bigger problems than
class names to deal with!




                                                                          ā€
          https://speakerdeck.com/andyhume/css-for-grown-ups-maturing-best-practises
Move forward
In order to move forward,
especially on large scale sites, we
cannot keep using old practices.
Solution?
OOCSS offers front end
developers an alternative - light
weight, modular CSS that can be
re-used repeatedly across sites.
acss
   srmtecture
css achi
What is SMACSS?
ā€œ
SMACSS is more style guide than
rigid framework - an attempt to
document a consistent approach
to site development when using
CSS.



                                                            ā€
                   http://alistapart.com/article/frameworksfordesigners
In 2011, Jonathan
Snook introduced a
new way of looking at
CSS architecture.
He called this
Scalable and Modular
Architecture for CSS
(SMACSS)
Categorization
Categories
Base rules
Layout rules
Module (and sub-module) rules
State rules
Theme rules
Base
Base rules are the defaults. They
are almost exclusively single
element selectors.
Layout
Layout rules divide the page into
sections. Layouts hold one or
more modules together.
Modules
Modules are the reusable,
modular parts of our design. They
are the callouts, the sidebar
sections, the product lists and so
on.
SMACSS allows for
primary modules, modiļ¬ers
and sub-modules, though they
are labelled slightly differently.
Primary module   Sub-module      Modiļ¬er
                 Sub-component   Sub-module
.row-alt1                        .row-alt1
.box             .box-feature
                 .box-body
States
State rules are ways to describe
how our modules or layouts will
look when in a particular state. Is
it hidden or expanded?
Themes
Theme rules describe how the
layout or modules might look.
Naming Convention
Avoid IDs
Use classes rather than IDs for
styling purposes. Classes are
more ļ¬‚exible. Using classes can
reduce speciļ¬city issues.
Meaningful
Class names should be
meaningful for other authors, so
that other developers can
understand their purpose.
Pattern
Class names should follow
understandable patterns.
Prefixes
Use ā€œpseudo-namespacesā€ as
preļ¬xes - so that modules,
modiļ¬ers and sub-modules can
be identiļ¬ed.
Modifiers
 Possibly use different naming
 conventions for modiļ¬ers,
 sub-modules and states.

.example-widget { }
.example-widget--modifier { }
.example-widget__sub-module { }
.example-widget--is-somestate { }
Decouple HTML/CSS
ā€œ
Iā€™ve noticed that designers
traditionally write CSS that is
deeply tied to the HTML that it is
designed to style. How do we
begin to decouple the two for
more flexible development with


                                                                        ā€
less refactoring?
           http://coding.smashingmagazine.com/2012/04/20/decoupling-html-from-css/
Decouple
So how do we ā€œdecoupleā€ our
HTML and CSS.
1. using additional class names
2. using child selectors
Example
To see this in action, letā€™s look at
the ā€œboxā€ example from earlier.
What if we wanted to style the
heading inside the ā€œbox-bodyā€.
This is a heading            heading

Lorem ipsum dolor sit amet consect etuer
adipi scing elit sed diam nonummy nibh
euismod tinunt ut laoreet dolore magna
aliquam erat volut.
Style the h2?
We could style this heading using
something like this:


.box { }
.box h2 { }
<div class="box">
!   <img class="box-feature"
!   src="dummy-140.png" alt="">
!   <div class="box-body">
!   !   <h2>Heading</h2>
!   !   </p>Lorem ipsum dolor</p>
!   </div>
</div>
Problem?
The problem is that the CSS is
ā€œcoupledā€ with the HTML. What
happens if there is an <h3>
element inside the box?
One solution would be to set all
heading levels.

.box   { }
.box   h1 {   }
.box   h2 {   }
.box   h3 {   }
.box   h4 {   }
.box   h5 {   }
.box   h6 {   }
Use a class
However, the safest way to
ā€œuncoupleā€ the CSS and HTML
would be to use a simple class.
<div class="box">
!   <img class="box-feature"
!   src="dummy-140.png" alt="">
!   <div class="box-body">
!   !   <h2 class="box-heading">
!   !   !   Heading</h2>
!   !   </p>Lorem ipsum dolor</p>
!   </div>
</div>
More flexible
Now our HTML and CSS are more
ļ¬‚exible. It doesnā€™t matter what
heading level is used.


.box { }
.box-heading { }
a closer look at
     modules
Guidelines
The following ā€œmoduleā€ guidelines
apply regardless of whether you
are coming from OOCSS or
SMACSS.
Rule 1:
keep modules simple
ā€œ
By making your base objects this
simple your choices become
boolean; you use the object or
you donā€™t. The object is either
entirely suitable as a basis, or
entirely _un_suitable.


                                                                          ā€
             http://csswizardry.com/2012/06/the-open-closed-principle-applied-to-css/
Keep ā€˜em simple
The base module should be
deļ¬ned as simply as possible.
This means that they are highly
ļ¬‚exible.
Letā€™s use an example of our ā€œrowā€
 class. What if we added some
 padding to this rule?


.row {
!   clear: left;
!   overflow: hidden;
!   padding: 20px 0;
}
But what if we want a row that
doesnā€™t have padding? The
problem is that this rule is now
very speciļ¬cally deļ¬ned. It is
therefore not as ļ¬‚exible.
Rule 2:
donā€™t undo styles
ā€œ
Any CSS that unsets styles (apart
from in a reset) should start
ringing alarm bells... Rulesets
should only ever inherit and add
to previous ones, never undo.



                                                           ā€
                    http://csswizardry.com/2012/11/code-smells-in-css/
Donā€™t undo
Leading on from the ļ¬rst rule, you
should avoid writing rules to undo
a previous module.
For example, what if you wanted
 almost all of your headings to
 have a border-bottom?

h2 {
!   font-size: 1.5em
!   margin-bottom: 1em;
!   padding-bottom: 1em;
!   border-bottom: 1px solid red;
}
But in some cases you might
want a heading without a
border-bottom.
You could write a new rule like
 this:


.no-border {
!   padding-bottom: 0;
!   border-bottom: none;
}
This is not ideal. It is much better
to write sub-modules that add
styles, rather than write sub-
modules to undo styles.
So, a better way might be to
write two rules like this:
/* default style */
h2 {
!   font-size: 1.5em
!   margin-bottom: 1em;
}

/* only when border needed */
.headline {
!   padding-bottom: 1em;
!   border-bottom: 1px solid red;
}
Rule 3:
extend but donā€™t
    modify
Donā€™t modify
Base modules can be extended
using sub-modules. However, the
base module itself should never
be modiļ¬ed.
This is based on the object
oriented programming ā€œopen/
close principleā€.
ā€œ
Software entities (classes,
modules, functions, etc.) should
be open for extension, but closed
for modification.




                                                            ā€
                     http://en.wikipedia.org/wiki/Open/closed_principle
If a based module needs to be
modiļ¬ed to suit a speciļ¬c case, it
is probably better to create a
new module.
Rule 4:
think before adding
   new modules
Donā€™t rush
It is always tempting to add a
module based on your need at
the time... as well as based on
the needs of the system.
This often happens after the initial
planning and build has been
done. Itā€™s easy to be tempted by
ā€œIā€™ll just drop this new class in
at the bottom of my CSSā€.
However, adding poorly
structured new modules, without
rigorous abstraction, will lead to
bloated, hard-to-manage CSS.
ices
coding
pract
Comment conventions
DocBlock
There is a growing trend to use
the DocBlock as an overall
comment convention. In fact, a
movement around this type of
commenting began over 6 years
ago with the CSSdoc group
ā€œ
"A DocBlock is an extended C++-
style PHP comment that begins
with "/**" and has an "*" at the
beginning of every line.
DocBlocks precede the element
they are documenting...


                                                   ā€
                           http://en.wikipedia.org/wiki/PHPDoc
/**
 * Short desc
 *
 * Long description first sentence starts
 * and continues on this line for a while
 * finally concluding here at the end of
 * this paragraph
 *
 * The blank line above denotes a paragraph
 */
Formatting CSS rules
Single line?
In the early days of CSS, a lot of
developers preferred single line
CSS rules as they could easily
see the selectors.
Multi-line
Today, with the complexity of
individual rules, most developers
seem to prefer either the
multi-line format, or multi-line
with indenting format.
CSS Tricks rule formatting poll

Multi-line Format with Indenting                                     44%
Multi-line Format                                                    28%
Single-line Format                                                   11%
Single-line Format with Indenting/Tabbing                             5%
Mostly Single-line Format                                             5%
Single-line Format with Tabbing                                       4%
Other                                                                 3%


                    *CSS-tricks poll: http://css-tricks.com/different-ways-to-format-css/
.navigation_rss_icon {
!   position: absolute;
!   left: 940px;
!   bottom: 0px;
}

#navigation_rss {
!   position: absolute;
!   left: 720px;
!   font-family: Verdana, Arial, Helvetica, sans-serif;
!   text-transform: uppercase;
!   color: #897567;
!   line-height: 2.5em;
}

#navigation_rss li {
!   display: inline;
}

#navigation_rss li a:link, #navigation_rss li a:visited {
!   color: #fffffe;
!   text-decoration: none;
.navigation_rss_icon {
    position: absolute;
    left: 940px;
    bottom: 0px;
}

#navigation_rss {
    position: absolute;
    left: 720px;
    font-family: Verdana, Arial, Helvetica, sans-serif;
    text-transform: uppercase;
    color: #897567;
    line-height: 2.5em;
}

    #navigation_rss li {
        display: inline;
    }

        #navigation_rss li a:link, #navigation_rss li a:visited {
            color: #fffffe;
            text-decoration: none;
Declaration order
Alphabet?
Similarly, many developers used
to prefer to sort their declarations
alphabetically.
Group
Today, most people prefer to
group their declarations by type.
CSS Tricks declaration formatting poll

Grouped by type 45%                                                 45%
Random - 39%                                                        39%
Alphabet - 14%                                                      14%
By line - 2%                                                         2%




                   *CSS-tricks poll: http://css-tricks.com/different-ways-to-format-css/
.selector {
  /* Positioning */
  position: absolute;
  z-index: 10;
  top: 0;
  right: 0;

  /* Display & Box Model */
  display: inline-block;
  overflow: hidden;
  box-sizing: border-box;
  width: 100px;
  height: 100px;
  padding: 10px;
  border: 10px solid #333;
  margin: 10px;

  /* Color */
  background: #000;
  color: #fff

  /* Text */
Of course, many tools and pre-
processors take care of this for
you. If your tools do not have this
capability, take a look at CSS
Comb
http://csscomb.com/
get busy!
Russ Weakley
Max Design

Site: maxdesign.com.au
Twitter: twitter.com/russmaxdesign
Slideshare: slideshare.net/maxdesign
Linkedin: linkedin.com/in/russweakley

More Related Content

What's hot

Introduction to HTML and CSS
Introduction to HTML and CSSIntroduction to HTML and CSS
Introduction to HTML and CSSMario Hernandez
Ā 
CSS Best practice
CSS Best practiceCSS Best practice
CSS Best practiceRuss Weakley
Ā 
What is Object Oriented CSS?
What is Object Oriented CSS?What is Object Oriented CSS?
What is Object Oriented CSS?Nicole Sullivan
Ā 
CSS3 Media Queries And Creating Adaptive Layouts
CSS3 Media Queries And Creating Adaptive LayoutsCSS3 Media Queries And Creating Adaptive Layouts
CSS3 Media Queries And Creating Adaptive LayoutsSvitlana Ivanytska
Ā 
Introduction to Cascading Style Sheets (CSS)
Introduction to Cascading Style Sheets (CSS)Introduction to Cascading Style Sheets (CSS)
Introduction to Cascading Style Sheets (CSS)Chris Poteet
Ā 
Introduction to Cascading Style Sheets
Introduction to Cascading Style SheetsIntroduction to Cascading Style Sheets
Introduction to Cascading Style SheetsTushar Joshi
Ā 
CSS Flexbox (flexible box layout)
CSS Flexbox (flexible box layout)CSS Flexbox (flexible box layout)
CSS Flexbox (flexible box layout)Woodridge Software
Ā 
Bootstrap Part - 1
Bootstrap Part - 1Bootstrap Part - 1
Bootstrap Part - 1EPAM Systems
Ā 
Bootstrap PPT by Mukesh
Bootstrap PPT by MukeshBootstrap PPT by Mukesh
Bootstrap PPT by MukeshMukesh Kumar
Ā 
Advanced Cascading Style Sheets
Advanced Cascading Style SheetsAdvanced Cascading Style Sheets
Advanced Cascading Style Sheetsfantasticdigitaltools
Ā 
The Power of CSS Flexbox
The Power of CSS FlexboxThe Power of CSS Flexbox
The Power of CSS Flexboxfreshlybakedpixels
Ā 
CSS3, Media Queries, and Responsive Design
CSS3, Media Queries, and Responsive DesignCSS3, Media Queries, and Responsive Design
CSS3, Media Queries, and Responsive DesignZoe Gillenwater
Ā 
Less vs sass
Less vs sassLess vs sass
Less vs sassAya Edamoto
Ā 
Introduction to flexbox
Introduction  to  flexboxIntroduction  to  flexbox
Introduction to flexboxJyoti Gautam
Ā 

What's hot (20)

Introduction to HTML and CSS
Introduction to HTML and CSSIntroduction to HTML and CSS
Introduction to HTML and CSS
Ā 
CSS Best practice
CSS Best practiceCSS Best practice
CSS Best practice
Ā 
HTML5 Tutorial
HTML5 TutorialHTML5 Tutorial
HTML5 Tutorial
Ā 
What is Object Oriented CSS?
What is Object Oriented CSS?What is Object Oriented CSS?
What is Object Oriented CSS?
Ā 
CSS3 Media Queries And Creating Adaptive Layouts
CSS3 Media Queries And Creating Adaptive LayoutsCSS3 Media Queries And Creating Adaptive Layouts
CSS3 Media Queries And Creating Adaptive Layouts
Ā 
Introduction to Cascading Style Sheets (CSS)
Introduction to Cascading Style Sheets (CSS)Introduction to Cascading Style Sheets (CSS)
Introduction to Cascading Style Sheets (CSS)
Ā 
Introduction to Cascading Style Sheets
Introduction to Cascading Style SheetsIntroduction to Cascading Style Sheets
Introduction to Cascading Style Sheets
Ā 
Bootstrap 5 basic
Bootstrap 5 basicBootstrap 5 basic
Bootstrap 5 basic
Ā 
CSS Flexbox (flexible box layout)
CSS Flexbox (flexible box layout)CSS Flexbox (flexible box layout)
CSS Flexbox (flexible box layout)
Ā 
Css
CssCss
Css
Ā 
Bootstrap Part - 1
Bootstrap Part - 1Bootstrap Part - 1
Bootstrap Part - 1
Ā 
Bootstrap PPT by Mukesh
Bootstrap PPT by MukeshBootstrap PPT by Mukesh
Bootstrap PPT by Mukesh
Ā 
Bootstrap 5 ppt
Bootstrap 5 pptBootstrap 5 ppt
Bootstrap 5 ppt
Ā 
Advanced Cascading Style Sheets
Advanced Cascading Style SheetsAdvanced Cascading Style Sheets
Advanced Cascading Style Sheets
Ā 
Css backgrounds
Css   backgroundsCss   backgrounds
Css backgrounds
Ā 
The Power of CSS Flexbox
The Power of CSS FlexboxThe Power of CSS Flexbox
The Power of CSS Flexbox
Ā 
CSS3, Media Queries, and Responsive Design
CSS3, Media Queries, and Responsive DesignCSS3, Media Queries, and Responsive Design
CSS3, Media Queries, and Responsive Design
Ā 
CSS Selectors
CSS SelectorsCSS Selectors
CSS Selectors
Ā 
Less vs sass
Less vs sassLess vs sass
Less vs sass
Ā 
Introduction to flexbox
Introduction  to  flexboxIntroduction  to  flexbox
Introduction to flexbox
Ā 

Viewers also liked

Atomic design
Atomic designAtomic design
Atomic designBrad Frost
Ā 
Scalable and Modular CSS FTW!
Scalable and Modular CSS FTW!Scalable and Modular CSS FTW!
Scalable and Modular CSS FTW!FITC
Ā 
Cascading Style Sheets - CSS
Cascading Style Sheets - CSSCascading Style Sheets - CSS
Cascading Style Sheets - CSSSun Technlogies
Ā 
HTML, CSS and Java Scripts Basics
HTML, CSS and Java Scripts BasicsHTML, CSS and Java Scripts Basics
HTML, CSS and Java Scripts BasicsSun Technlogies
Ā 
Object Oriented CSS
Object Oriented CSSObject Oriented CSS
Object Oriented CSSNicole Sullivan
Ā 
[čƑ]Efficient, maintainable CSS
[čƑ]Efficient, maintainable CSS[čƑ]Efficient, maintainable CSS
[čƑ]Efficient, maintainable CSSjeannewoo
Ā 
Creating a Simple, Accessible On/Off Switch
Creating a Simple, Accessible On/Off SwitchCreating a Simple, Accessible On/Off Switch
Creating a Simple, Accessible On/Off SwitchRuss Weakley
Ā 
Html Ppt
Html PptHtml Ppt
Html Pptvijayanit
Ā 
CSS: a rapidly changing world
CSS: a rapidly changing worldCSS: a rapidly changing world
CSS: a rapidly changing worldRuss Weakley
Ā 
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 FriendsStacy Kvernmo
Ā 
OOCSS and SMACSS Case Study
OOCSS and SMACSS Case StudyOOCSS and SMACSS Case Study
OOCSS and SMACSS Case StudyKota Fujishiro
Ā 
Php Presentation
Php PresentationPhp Presentation
Php PresentationManish Bothra
Ā 
CSS in React - The Good, The Bad, and The Ugly
CSS in React - The Good, The Bad, and The UglyCSS in React - The Good, The Bad, and The Ugly
CSS in React - The Good, The Bad, and The UglyJoe Seifi
Ā 
Html / CSS Presentation
Html / CSS PresentationHtml / CSS Presentation
Html / CSS PresentationShawn Calvert
Ā 
Accessible custom radio buttons and checkboxes
Accessible custom radio buttons and checkboxesAccessible custom radio buttons and checkboxes
Accessible custom radio buttons and checkboxesRuss Weakley
Ā 
Three quick accessibility tips for HTML5
Three quick accessibility tips for HTML5Three quick accessibility tips for HTML5
Three quick accessibility tips for HTML5Russ Weakley
Ā 
OOCSS in the Real World: A Case Study from the CBC
OOCSS in the Real World: A Case Study from the CBCOOCSS in the Real World: A Case Study from the CBC
OOCSS in the Real World: A Case Study from the CBCJamie Strachan
Ā 
OOCSS presentation
OOCSS presentationOOCSS presentation
OOCSS presentationAndrew Ford
Ā 
OOCSS in the Real World: A Case Study from the CBC - Revisited
OOCSS in the Real World: A Case Study from the CBC - RevisitedOOCSS in the Real World: A Case Study from the CBC - Revisited
OOCSS in the Real World: A Case Study from the CBC - RevisitedJamie Strachan
Ā 

Viewers also liked (20)

Atomic design
Atomic designAtomic design
Atomic design
Ā 
Scalable and Modular CSS FTW!
Scalable and Modular CSS FTW!Scalable and Modular CSS FTW!
Scalable and Modular CSS FTW!
Ā 
Cascading Style Sheets - CSS
Cascading Style Sheets - CSSCascading Style Sheets - CSS
Cascading Style Sheets - CSS
Ā 
HTML, CSS and Java Scripts Basics
HTML, CSS and Java Scripts BasicsHTML, CSS and Java Scripts Basics
HTML, CSS and Java Scripts Basics
Ā 
Object Oriented CSS
Object Oriented CSSObject Oriented CSS
Object Oriented CSS
Ā 
[čƑ]Efficient, maintainable CSS
[čƑ]Efficient, maintainable CSS[čƑ]Efficient, maintainable CSS
[čƑ]Efficient, maintainable CSS
Ā 
Creating a Simple, Accessible On/Off Switch
Creating a Simple, Accessible On/Off SwitchCreating a Simple, Accessible On/Off Switch
Creating a Simple, Accessible On/Off Switch
Ā 
Html Ppt
Html PptHtml Ppt
Html Ppt
Ā 
CSS: a rapidly changing world
CSS: a rapidly changing worldCSS: a rapidly changing world
CSS: a rapidly changing world
Ā 
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
Ā 
OOCSS and SMACSS Case Study
OOCSS and SMACSS Case StudyOOCSS and SMACSS Case Study
OOCSS and SMACSS Case Study
Ā 
Php Presentation
Php PresentationPhp Presentation
Php Presentation
Ā 
CSS in React - The Good, The Bad, and The Ugly
CSS in React - The Good, The Bad, and The UglyCSS in React - The Good, The Bad, and The Ugly
CSS in React - The Good, The Bad, and The Ugly
Ā 
Html / CSS Presentation
Html / CSS PresentationHtml / CSS Presentation
Html / CSS Presentation
Ā 
Accessible custom radio buttons and checkboxes
Accessible custom radio buttons and checkboxesAccessible custom radio buttons and checkboxes
Accessible custom radio buttons and checkboxes
Ā 
PSD to Theme: The SMACSS Way
PSD to Theme: The SMACSS WayPSD to Theme: The SMACSS Way
PSD to Theme: The SMACSS Way
Ā 
Three quick accessibility tips for HTML5
Three quick accessibility tips for HTML5Three quick accessibility tips for HTML5
Three quick accessibility tips for HTML5
Ā 
OOCSS in the Real World: A Case Study from the CBC
OOCSS in the Real World: A Case Study from the CBCOOCSS in the Real World: A Case Study from the CBC
OOCSS in the Real World: A Case Study from the CBC
Ā 
OOCSS presentation
OOCSS presentationOOCSS presentation
OOCSS presentation
Ā 
OOCSS in the Real World: A Case Study from the CBC - Revisited
OOCSS in the Real World: A Case Study from the CBC - RevisitedOOCSS in the Real World: A Case Study from the CBC - Revisited
OOCSS in the Real World: A Case Study from the CBC - Revisited
Ā 

Similar to CSS - OOCSS, SMACSS and more

CSMess to OOCSS: Refactoring CSS with Object Oriented Design
CSMess to OOCSS: Refactoring CSS with Object Oriented DesignCSMess to OOCSS: Refactoring CSS with Object Oriented Design
CSMess to OOCSS: Refactoring CSS with Object Oriented DesignKate Travers
Ā 
OOCSS for JavaScript Pirates jQcon Boston
OOCSS for JavaScript Pirates jQcon BostonOOCSS for JavaScript Pirates jQcon Boston
OOCSS for JavaScript Pirates jQcon BostonJohn Hann
Ā 
OOCSS for Javascript pirates at jQueryPgh meetup
OOCSS for Javascript pirates at jQueryPgh meetupOOCSS for Javascript pirates at jQueryPgh meetup
OOCSS for Javascript pirates at jQueryPgh meetupBrian Cavalier
Ā 
The New UI - Staying Strong with Flexbox, SASS, and {{Mustache.js}}
The New UI - Staying Strong with Flexbox, SASS, and {{Mustache.js}}The New UI - Staying Strong with Flexbox, SASS, and {{Mustache.js}}
The New UI - Staying Strong with Flexbox, SASS, and {{Mustache.js}}Eric Carlisle
Ā 
But what about old browsers?
But what about old browsers?But what about old browsers?
But what about old browsers?Rachel Andrew
Ā 
Object-Oriented CSS 從 OOCSS, SMACSS, BEM 到 AMCSS
Object-Oriented CSS 從 OOCSS, SMACSS, BEM 到 AMCSSObject-Oriented CSS 從 OOCSS, SMACSS, BEM 到 AMCSS
Object-Oriented CSS 從 OOCSS, SMACSS, BEM 到 AMCSSLi-Wei Lu
Ā 
The New CSS Layout - Dutch PHP Conference
The New CSS Layout - Dutch PHP ConferenceThe New CSS Layout - Dutch PHP Conference
The New CSS Layout - Dutch PHP ConferenceRachel Andrew
Ā 
CSS pattern libraries
CSS pattern librariesCSS pattern libraries
CSS pattern librariesRuss Weakley
Ā 
CSS workshop @ OutSystems
CSS workshop @ OutSystemsCSS workshop @ OutSystems
CSS workshop @ OutSystemsRuben Goncalves
Ā 
SMACSS Workshop
SMACSS WorkshopSMACSS Workshop
SMACSS WorkshopTim Hettler
Ā 
CSS Frameworks
CSS FrameworksCSS Frameworks
CSS FrameworksMike Crabb
Ā 
INTRODUCTIONS OF CSS PART 2
INTRODUCTIONS OF CSS PART 2INTRODUCTIONS OF CSS PART 2
INTRODUCTIONS OF CSS PART 2SURYANARAYANBISWAL1
Ā 
The Future State of Layout
The Future State of LayoutThe Future State of Layout
The Future State of LayoutStephen Hay
Ā 
Scalable CSS You and Your Back-End Coders Can Love - @CSSConf Asia 2014
Scalable CSS You and Your Back-End Coders Can Love - @CSSConf Asia 2014Scalable CSS You and Your Back-End Coders Can Love - @CSSConf Asia 2014
Scalable CSS You and Your Back-End Coders Can Love - @CSSConf Asia 2014Christian Lilley
Ā 
Rock Solid CSS Architecture
Rock Solid CSS ArchitectureRock Solid CSS Architecture
Rock Solid CSS ArchitectureJohn Need
Ā 
Architecture for css
Architecture for cssArchitecture for css
Architecture for cssMohamed Amin
Ā 
Everything You know about CSS is Wrong
Everything You know about CSS is WrongEverything You know about CSS is Wrong
Everything You know about CSS is Wrongchandleryu
Ā 

Similar to CSS - OOCSS, SMACSS and more (20)

CSMess to OOCSS: Refactoring CSS with Object Oriented Design
CSMess to OOCSS: Refactoring CSS with Object Oriented DesignCSMess to OOCSS: Refactoring CSS with Object Oriented Design
CSMess to OOCSS: Refactoring CSS with Object Oriented Design
Ā 
OOCSS for JavaScript Pirates jQcon Boston
OOCSS for JavaScript Pirates jQcon BostonOOCSS for JavaScript Pirates jQcon Boston
OOCSS for JavaScript Pirates jQcon Boston
Ā 
OOCSS for Javascript pirates at jQueryPgh meetup
OOCSS for Javascript pirates at jQueryPgh meetupOOCSS for Javascript pirates at jQueryPgh meetup
OOCSS for Javascript pirates at jQueryPgh meetup
Ā 
The New UI - Staying Strong with Flexbox, SASS, and {{Mustache.js}}
The New UI - Staying Strong with Flexbox, SASS, and {{Mustache.js}}The New UI - Staying Strong with Flexbox, SASS, and {{Mustache.js}}
The New UI - Staying Strong with Flexbox, SASS, and {{Mustache.js}}
Ā 
But what about old browsers?
But what about old browsers?But what about old browsers?
But what about old browsers?
Ā 
Object-Oriented CSS 從 OOCSS, SMACSS, BEM 到 AMCSS
Object-Oriented CSS 從 OOCSS, SMACSS, BEM 到 AMCSSObject-Oriented CSS 從 OOCSS, SMACSS, BEM 到 AMCSS
Object-Oriented CSS 從 OOCSS, SMACSS, BEM 到 AMCSS
Ā 
The New CSS Layout - Dutch PHP Conference
The New CSS Layout - Dutch PHP ConferenceThe New CSS Layout - Dutch PHP Conference
The New CSS Layout - Dutch PHP Conference
Ā 
CSS pattern libraries
CSS pattern librariesCSS pattern libraries
CSS pattern libraries
Ā 
CSS workshop @ OutSystems
CSS workshop @ OutSystemsCSS workshop @ OutSystems
CSS workshop @ OutSystems
Ā 
SMACSS Workshop
SMACSS WorkshopSMACSS Workshop
SMACSS Workshop
Ā 
CSS Frameworks
CSS FrameworksCSS Frameworks
CSS Frameworks
Ā 
INTRODUCTIONS OF CSS PART 2
INTRODUCTIONS OF CSS PART 2INTRODUCTIONS OF CSS PART 2
INTRODUCTIONS OF CSS PART 2
Ā 
The Future State of Layout
The Future State of LayoutThe Future State of Layout
The Future State of Layout
Ā 
Refresh OKC
Refresh OKCRefresh OKC
Refresh OKC
Ā 
Material design
Material designMaterial design
Material design
Ā 
Scalable CSS You and Your Back-End Coders Can Love - @CSSConf Asia 2014
Scalable CSS You and Your Back-End Coders Can Love - @CSSConf Asia 2014Scalable CSS You and Your Back-End Coders Can Love - @CSSConf Asia 2014
Scalable CSS You and Your Back-End Coders Can Love - @CSSConf Asia 2014
Ā 
Rock Solid CSS Architecture
Rock Solid CSS ArchitectureRock Solid CSS Architecture
Rock Solid CSS Architecture
Ā 
Architecture for css
Architecture for cssArchitecture for css
Architecture for css
Ā 
Everything You know about CSS is Wrong
Everything You know about CSS is WrongEverything You know about CSS is Wrong
Everything You know about CSS is Wrong
Ā 
Pfnp slides
Pfnp slidesPfnp slides
Pfnp slides
Ā 

More from Russ Weakley

Accessible chat windows
Accessible chat windowsAccessible chat windows
Accessible chat windowsRuss Weakley
Ā 
Accessible names & descriptions
Accessible names & descriptionsAccessible names & descriptions
Accessible names & descriptionsRuss Weakley
Ā 
A deep dive into accessible names
A deep dive into accessible namesA deep dive into accessible names
A deep dive into accessible namesRuss Weakley
Ā 
What are accessible names and why should you care?
What are accessible names and why should you care?What are accessible names and why should you care?
What are accessible names and why should you care?Russ Weakley
Ā 
How to build accessible UI components
How to build accessible UI componentsHow to build accessible UI components
How to build accessible UI componentsRuss Weakley
Ā 
What is WCAG 2 and why should we care?
What is WCAG 2 and why should we care?What is WCAG 2 and why should we care?
What is WCAG 2 and why should we care?Russ Weakley
Ā 
Accessible states in Design Systems
Accessible states in Design SystemsAccessible states in Design Systems
Accessible states in Design SystemsRuss Weakley
Ā 
Creating accessible modals and autocompletes
Creating accessible modals and autocompletesCreating accessible modals and autocompletes
Creating accessible modals and autocompletesRuss Weakley
Ā 
Building an accessible progressive loader
Building an accessible progressive loaderBuilding an accessible progressive loader
Building an accessible progressive loaderRuss Weakley
Ā 
Accessibility in Design systems - the pain and glory
Accessibility in Design systems - the pain and gloryAccessibility in Design systems - the pain and glory
Accessibility in Design systems - the pain and gloryRuss Weakley
Ā 
Accessible Inline errors messages
Accessible Inline errors messagesAccessible Inline errors messages
Accessible Inline errors messagesRuss Weakley
Ā 
Accessible Form Hints and Errors
Accessible Form Hints and ErrorsAccessible Form Hints and Errors
Accessible Form Hints and ErrorsRuss Weakley
Ā 
What is accessibility?
What is accessibility?What is accessibility?
What is accessibility?Russ Weakley
Ā 
Accessibility in Pattern Libraries
Accessibility in Pattern LibrariesAccessibility in Pattern Libraries
Accessibility in Pattern LibrariesRuss Weakley
Ā 
Accessibility in pattern libraries
Accessibility in pattern librariesAccessibility in pattern libraries
Accessibility in pattern librariesRuss Weakley
Ā 
Building an accessible auto-complete - #ID24
Building an accessible auto-complete - #ID24Building an accessible auto-complete - #ID24
Building an accessible auto-complete - #ID24Russ Weakley
Ā 
Building an accessible auto-complete
Building an accessible auto-completeBuilding an accessible auto-complete
Building an accessible auto-completeRuss Weakley
Ā 
Creating Acessible floating labels
Creating Acessible floating labelsCreating Acessible floating labels
Creating Acessible floating labelsRuss Weakley
Ā 
Creating an Accessible button dropdown
Creating an Accessible button dropdownCreating an Accessible button dropdown
Creating an Accessible button dropdownRuss Weakley
Ā 
Deep Dive into Line-Height
Deep Dive into Line-HeightDeep Dive into Line-Height
Deep Dive into Line-HeightRuss Weakley
Ā 

More from Russ Weakley (20)

Accessible chat windows
Accessible chat windowsAccessible chat windows
Accessible chat windows
Ā 
Accessible names & descriptions
Accessible names & descriptionsAccessible names & descriptions
Accessible names & descriptions
Ā 
A deep dive into accessible names
A deep dive into accessible namesA deep dive into accessible names
A deep dive into accessible names
Ā 
What are accessible names and why should you care?
What are accessible names and why should you care?What are accessible names and why should you care?
What are accessible names and why should you care?
Ā 
How to build accessible UI components
How to build accessible UI componentsHow to build accessible UI components
How to build accessible UI components
Ā 
What is WCAG 2 and why should we care?
What is WCAG 2 and why should we care?What is WCAG 2 and why should we care?
What is WCAG 2 and why should we care?
Ā 
Accessible states in Design Systems
Accessible states in Design SystemsAccessible states in Design Systems
Accessible states in Design Systems
Ā 
Creating accessible modals and autocompletes
Creating accessible modals and autocompletesCreating accessible modals and autocompletes
Creating accessible modals and autocompletes
Ā 
Building an accessible progressive loader
Building an accessible progressive loaderBuilding an accessible progressive loader
Building an accessible progressive loader
Ā 
Accessibility in Design systems - the pain and glory
Accessibility in Design systems - the pain and gloryAccessibility in Design systems - the pain and glory
Accessibility in Design systems - the pain and glory
Ā 
Accessible Inline errors messages
Accessible Inline errors messagesAccessible Inline errors messages
Accessible Inline errors messages
Ā 
Accessible Form Hints and Errors
Accessible Form Hints and ErrorsAccessible Form Hints and Errors
Accessible Form Hints and Errors
Ā 
What is accessibility?
What is accessibility?What is accessibility?
What is accessibility?
Ā 
Accessibility in Pattern Libraries
Accessibility in Pattern LibrariesAccessibility in Pattern Libraries
Accessibility in Pattern Libraries
Ā 
Accessibility in pattern libraries
Accessibility in pattern librariesAccessibility in pattern libraries
Accessibility in pattern libraries
Ā 
Building an accessible auto-complete - #ID24
Building an accessible auto-complete - #ID24Building an accessible auto-complete - #ID24
Building an accessible auto-complete - #ID24
Ā 
Building an accessible auto-complete
Building an accessible auto-completeBuilding an accessible auto-complete
Building an accessible auto-complete
Ā 
Creating Acessible floating labels
Creating Acessible floating labelsCreating Acessible floating labels
Creating Acessible floating labels
Ā 
Creating an Accessible button dropdown
Creating an Accessible button dropdownCreating an Accessible button dropdown
Creating an Accessible button dropdown
Ā 
Deep Dive into Line-Height
Deep Dive into Line-HeightDeep Dive into Line-Height
Deep Dive into Line-Height
Ā 

Recently uploaded

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.pptxHampshireHUG
Ā 
FULL ENJOY šŸ” 8264348440 šŸ” Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY šŸ” 8264348440 šŸ” Call Girls in Diplomatic Enclave | DelhiFULL ENJOY šŸ” 8264348440 šŸ” Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY šŸ” 8264348440 šŸ” Call Girls in Diplomatic Enclave | Delhisoniya singh
Ā 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
Ā 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
Ā 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
Ā 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
Ā 
SIEMENS: RAPUNZEL ā€“ A Tale About Knowledge Graph
SIEMENS: RAPUNZEL ā€“ A Tale About Knowledge GraphSIEMENS: RAPUNZEL ā€“ A Tale About Knowledge Graph
SIEMENS: RAPUNZEL ā€“ A Tale About Knowledge GraphNeo4j
Ā 
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.pptxMalak Abu Hammad
Ā 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
Ā 
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 MenDelhi Call girls
Ā 
Swan(sea) Song ā€“ personal research during my six years at Swansea ... and bey...
Swan(sea) Song ā€“ personal research during my six years at Swansea ... and bey...Swan(sea) Song ā€“ personal research during my six years at Swansea ... and bey...
Swan(sea) Song ā€“ personal research during my six years at Swansea ... and bey...Alan Dix
Ā 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
Ā 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
Ā 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
Ā 
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 2024Rafal Los
Ā 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
Ā 
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.pptxKatpro Technologies
Ā 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
Ā 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
Ā 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
Ā 

Recently uploaded (20)

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
Ā 
FULL ENJOY šŸ” 8264348440 šŸ” Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY šŸ” 8264348440 šŸ” Call Girls in Diplomatic Enclave | DelhiFULL ENJOY šŸ” 8264348440 šŸ” Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY šŸ” 8264348440 šŸ” Call Girls in Diplomatic Enclave | Delhi
Ā 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Ā 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
Ā 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
Ā 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
Ā 
SIEMENS: RAPUNZEL ā€“ A Tale About Knowledge Graph
SIEMENS: RAPUNZEL ā€“ A Tale About Knowledge GraphSIEMENS: RAPUNZEL ā€“ A Tale About Knowledge Graph
SIEMENS: RAPUNZEL ā€“ A Tale About Knowledge Graph
Ā 
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
Ā 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Ā 
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
Ā 
Swan(sea) Song ā€“ personal research during my six years at Swansea ... and bey...
Swan(sea) Song ā€“ personal research during my six years at Swansea ... and bey...Swan(sea) Song ā€“ personal research during my six years at Swansea ... and bey...
Swan(sea) Song ā€“ personal research during my six years at Swansea ... and bey...
Ā 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
Ā 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
Ā 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.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
Ā 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
Ā 
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
Ā 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Ā 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
Ā 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Ā 

CSS - OOCSS, SMACSS and more

  • 2. whatā€™s wro ng with CSS
  • 3. ā€œ CSS is simple... Itā€™s simple to understand. But CSS is not simple to use or maintain. ā€ http://chriseppstein.github.com/blog/2009/09/20/why-stylesheet-abstraction-matters/
  • 4. Issues If youā€™ve ever worked on a medium to large website, you have probably come across a range of issues with CSS.
  • 5. Repetition Lots of ļ¬‚oats, font-size references, heading levels repeated...
  • 6. Unmanageable It may have started out well, but it has become a mess?
  • 7. Weight war You need to add some CSS - so you have to start adding to selectors in order to win.
  • 8. Coupling Your CSS is speciļ¬cally tied to HTML or location...
  • 9. CSS sucks! Developers have been telling us for years that ā€œCSS sucksā€. We all know itā€™s time for our CSS practices to evolve.
  • 10. New stuff! Luckily, there are a wide range of exciting new developments to explore.
  • 11. Biases aside... Before we start... put aside any biases. At least until after the presentation, when you can rip into me :)
  • 12. ss oc oriented css o object
  • 14. In 2009, Nicole Sullivan introduced a new way of looking at CSS. She deļ¬ned this as Object Oriented CSS (OOCSS).
  • 15. Statistics After optimising Facebookā€™s CSS, she discovered some amazing statistics... about how we reapply CSS properties throughout our style sheets.
  • 16. Facebook: Facebook blue 261 Unique colors 548 colors 6,498 Salesforce: padding 3,668 h1-h6 511
  • 17. ā€œ ā€œWe have been doing it all wrong.... Our best practices are killing usā€ ā€ Nicole Sullivan
  • 18. ā€œ The purpose of OOCSS is to encourage code reuse and, ultimately, faster and more efficient stylesheets that are easier to add to and maintain. ā€ http://coding.smashingmagazine.com/2011/12/12/an-introduction-to-object-oriented-css-oocss/
  • 20. Abstraction One of the key aims of OOCSS is to abstract as many components of the layout as possible.
  • 21. Example Can you see any repeating visual patterns?
  • 22.
  • 23.
  • 24. Rows The ļ¬rst layout pattern could be the rows.
  • 27. Past practice In the past, people may have styled these rows using a series of IDs.
  • 29. OOCSS aims 1. use a single class so that it can be reused as needed 2. abstract the module down to core purposes
  • 30. Core purposes These rows have two purposes: 1. clear each row 2. trigger the block formatting context.
  • 32. Re-use Then we can write one simple, but very powerful class that can be reused anywhere in the layout.
  • 33. .row { ! clear: left; Clears each row ! overflow: hidden; Triggers block formatting ! zoom: 1; Triggers haslayout in IE5-7 ! _overflow: visible; IE6 underscore hack }
  • 35. Different rows Did you notice that two of the rows were different? They have different background colours and additional padding above and below.
  • 36.
  • 37. New names? We could now add some classes based on the purpose of these rows - such as ā€œnewsā€ and ā€œfooterā€.
  • 38. .news { ! padding: 1em 0; ! background-color: blue;! } .footer { ! padding: 1em 0; ! background-color: pink;! }
  • 39. Abstract However, it would be better to abstract these names further so that they are more ļ¬‚exible.
  • 40. .row { ! clear: left; ! overflow: hidden; ! zoom: 1; ! _overflow: visible; } .row-alt1 { ! padding: 1em 0; ! background-color: blue;! } .row-alt2 { ! padding: 1em 0; ! background-color: pink;! }
  • 41. <div class="row"></div> <div class="row"></div> <div class="row row-alt1"></div> <div class="row row-alt2"></div>
  • 42. Further If you wanted, these could be abstracted even further into padding and backgrounds as separate concepts.
  • 43. .row-padding { ! padding: 1em 0; } .bg-color1 { ! background-color: blue;! } .bg-color2 { ! background-color: pink;! }
  • 44. <div class="row"></div> <div class="row"></div> <div class="row row-padding bg-color1"></div> <div class="row row-padding bg-color2"></div>
  • 45. Up to you It depends on the site and circumstances as to how far you think you need to abstract these concepts.
  • 47. Primary module The ā€œrowā€ class is our primary module. The additional classes are ā€œmodiļ¬ersā€ as they modify the primary class.
  • 48. Modifiers Modiļ¬ers should not rewrite any aspect of the primary module, they only modify or add to the primary module.
  • 49. Types of class Primary module Sub-module Modiļ¬er .row-alt1 .row-alt1
  • 50. Looking for patterns - columns
  • 51. Columns The second layout pattern could be the columns. The wide layout looks like it has four columns.
  • 52. Column 1 Column 2 Column 3 Column 4
  • 53. Patterns Some of the rows spread across all columns. Others spread across two or one column.
  • 54. Column 1 Column 2 Column 3 Column 4 4 columns 2 columns 2 columns 2 columns 2 columns 1 columns 1 columns 1 columns 1 columns
  • 55. Framework 1 To be safe, we should assume we need containers for 4, 3, 2 and 1 column widths. We can convert these column options into a simple grid framework.
  • 56. Wide layout Class names 4 column box .w-4col 3 column box .w-3col 2 column box .w-2col 1 column box .w-1col
  • 57. <div class="row"> ! <div class="w-4col"></div> </div> <div class="row"> ! <div class="w-2col"></div> ! <div class="w-2col"></div> </div> <div class="row row-alt1"> ! <div class="w-2col"></div> ! <div class="w-2col"></div> </div> <div class="row row-alt2"> ! <div class="w-1col"></div> ! <div class="w-1col"></div> ! <div class="w-1col"></div> ! <div class="w-1col"></div> </div>
  • 58. Narrow The same is true of the narrow layout, except this time it has only two overall columns.
  • 59. Column 1 Column 2
  • 60. 2 columns 1 columns 1 columns 1 columns 1 columns 1 columns 1 columns
  • 61. Framework 2 We could also create a second, different grid for narrow screen. This would allow us to control whether columns sat beside each other or below at a narrower screen size.
  • 62. Narrow layout Class names 2 column box .n-2col 1 column box .n-2col
  • 63. <div class="row"> ! <div class="w-4col"></div> </div> <div class="row"> ! <div class="w-2col n-2col"></div> ! <div class="w-2col n-2col"></div> </div> <div class="row row-alt1"> ! <div class="w-2col n-2col"></div> ! <div class="w-2col n-2col"></div> </div> <div class="row row-alt2"> ! <div class="w-1col n-2col"></div> ! <div class="w-1col n-2col"></div> ! <div class="w-1col n-2col"></div> ! <div class="w-1col n-2col"></div> </div>
  • 64. Control! With these two simple grids, we can control complicated layouts - both wide and narrow.
  • 66. Boxes? You may have noticed that there were also a series of smaller boxes, each with an image to the left or right.
  • 67.
  • 68. Core purpose 1. contain content 2. feature object to left or right 3. content beside feature object 4. margin below
  • 69. Adaptable box We need to create an adaptable box: - could be placed anywhere - any width or height - any feature content - feature content could be left/right - any content inside the body
  • 70. Target We need to be able to target - the overall box - the object (left or right) - the body content within the box - a possible heading (h1-h6) - possibly even the contents itself
  • 71. box box body This is a heading heading box box feature Lorem ipsum dolor sit amet consect etuer adipi scing elit sed diam nonummy nibh box content euismod tinunt ut laoreet dolore magna aliquam erat volut.
  • 72. There are a range of possible class we could use here. .box { } .box-feature { } .box-feature-alt { } .box-body { } .box-heading { } .box-content { }
  • 73. Width Do not give the box a width - allow it to spread to ļ¬t the width of any parent container.
  • 74. Contain floats This box module must contain (and therefore wrap around) either a left or right ļ¬‚oating object. We can solve this by triggering the block formatting context on the parent.
  • 75. .box { ! overflow: hidden; Triggers block formatting ! zoom: 1; ! _overflow: visible; ! margin-bottom: 1em; }
  • 76. Location Agnostic The box must work when placed anywhere within the layout. The box must be ā€œlocation agnosticā€. aside .box { } .box { }
  • 77. Sit beside The box may contain objects that have varying widths. We need our content box (ā€œbox-bodyā€) to sit beside these objects, regardless of their widths.
  • 78. BFC again We can solve this by triggering the block formatting context on the ā€œbox-bodyā€ class.
  • 79. box-body This is a heading Lorem ipsum dolor sit amet consect etuer adipi scing elit sed diam nonummy nibh euismod tinunt ut laoreet dolore magna aliquam erat volut.
  • 80. .box-body { ! overflow: hidden; Triggers block formatting ! zoom: 1; ! _overflow: visible; }
  • 82. Powerful box We have just made a very powerful box. Nicole Sullivan refers to this box as the ā€œmediaā€ element.
  • 83. .box,.box-body { ! overflow: hidden; ! zoom: 1; ! _overflow: visible; } .box { margin: 0 0 10px; } .box-feature { ! float: left; ! margin: 0 10px 0 0; } .box-feature-alt { ! float: right; ! margin: 0 0 0 10px; }
  • 84. Primary module In this case, the ā€œboxā€ class is our primary module. There are no modiļ¬ers, but there are a range of sub-modules.
  • 85. Sub-modules Sub-modules are other classes associated with the primary module. They do not alter or add directly to the primary module.
  • 86. Types of class Primary module Sub-module Modiļ¬er .row-alt1 .row-alt1 .box .box-feature .box-body
  • 88. Semantic classes For years, we have been taught to keep our markup clean and only use ā€œsemanticā€ class names.
  • 89. Break the rules? OOCSS seems to break both of these rules - and in a big way. But have we been thinking about ā€œsemanticā€ class names in the wrong way?
  • 90. ā€œ HTML class names offer no semantic value to search engines or screen readers, aside from microformats. ā€ http://www.brettjankord.com/2013/02/09/thoughts-on-semantic-html-class-names-and-maintainability/
  • 91. ā€œ Rather than concerning ourselves with creating semantic class names, I think we should be thinking about creating sensible class names. Sensible class names offer semantics, but they ā€ also offer flexibility/reusability. http://www.brettjankord.com/2013/02/09/thoughts-on-semantic-html-class-names-and-maintainability/
  • 92. ā€œ If your class is called ā€œblueā€ and you want to change it to red, you have far bigger problems than class names to deal with! ā€ https://speakerdeck.com/andyhume/css-for-grown-ups-maturing-best-practises
  • 93. Move forward In order to move forward, especially on large scale sites, we cannot keep using old practices.
  • 94. Solution? OOCSS offers front end developers an alternative - light weight, modular CSS that can be re-used repeatedly across sites.
  • 95. acss srmtecture css achi
  • 97. ā€œ SMACSS is more style guide than rigid framework - an attempt to document a consistent approach to site development when using CSS. ā€ http://alistapart.com/article/frameworksfordesigners
  • 98. In 2011, Jonathan Snook introduced a new way of looking at CSS architecture. He called this Scalable and Modular Architecture for CSS (SMACSS)
  • 100. Categories Base rules Layout rules Module (and sub-module) rules State rules Theme rules
  • 101. Base Base rules are the defaults. They are almost exclusively single element selectors.
  • 102. Layout Layout rules divide the page into sections. Layouts hold one or more modules together.
  • 103. Modules Modules are the reusable, modular parts of our design. They are the callouts, the sidebar sections, the product lists and so on.
  • 104. SMACSS allows for primary modules, modiļ¬ers and sub-modules, though they are labelled slightly differently.
  • 105. Primary module Sub-module Modiļ¬er Sub-component Sub-module .row-alt1 .row-alt1 .box .box-feature .box-body
  • 106. States State rules are ways to describe how our modules or layouts will look when in a particular state. Is it hidden or expanded?
  • 107. Themes Theme rules describe how the layout or modules might look.
  • 109. Avoid IDs Use classes rather than IDs for styling purposes. Classes are more ļ¬‚exible. Using classes can reduce speciļ¬city issues.
  • 110. Meaningful Class names should be meaningful for other authors, so that other developers can understand their purpose.
  • 111. Pattern Class names should follow understandable patterns.
  • 112. Prefixes Use ā€œpseudo-namespacesā€ as preļ¬xes - so that modules, modiļ¬ers and sub-modules can be identiļ¬ed.
  • 113. Modifiers Possibly use different naming conventions for modiļ¬ers, sub-modules and states. .example-widget { } .example-widget--modifier { } .example-widget__sub-module { } .example-widget--is-somestate { }
  • 115. ā€œ Iā€™ve noticed that designers traditionally write CSS that is deeply tied to the HTML that it is designed to style. How do we begin to decouple the two for more flexible development with ā€ less refactoring? http://coding.smashingmagazine.com/2012/04/20/decoupling-html-from-css/
  • 116. Decouple So how do we ā€œdecoupleā€ our HTML and CSS. 1. using additional class names 2. using child selectors
  • 117. Example To see this in action, letā€™s look at the ā€œboxā€ example from earlier. What if we wanted to style the heading inside the ā€œbox-bodyā€.
  • 118. This is a heading heading Lorem ipsum dolor sit amet consect etuer adipi scing elit sed diam nonummy nibh euismod tinunt ut laoreet dolore magna aliquam erat volut.
  • 119. Style the h2? We could style this heading using something like this: .box { } .box h2 { }
  • 120. <div class="box"> ! <img class="box-feature" ! src="dummy-140.png" alt=""> ! <div class="box-body"> ! ! <h2>Heading</h2> ! ! </p>Lorem ipsum dolor</p> ! </div> </div>
  • 121. Problem? The problem is that the CSS is ā€œcoupledā€ with the HTML. What happens if there is an <h3> element inside the box?
  • 122. One solution would be to set all heading levels. .box { } .box h1 { } .box h2 { } .box h3 { } .box h4 { } .box h5 { } .box h6 { }
  • 123. Use a class However, the safest way to ā€œuncoupleā€ the CSS and HTML would be to use a simple class.
  • 124. <div class="box"> ! <img class="box-feature" ! src="dummy-140.png" alt=""> ! <div class="box-body"> ! ! <h2 class="box-heading"> ! ! ! Heading</h2> ! ! </p>Lorem ipsum dolor</p> ! </div> </div>
  • 125. More flexible Now our HTML and CSS are more ļ¬‚exible. It doesnā€™t matter what heading level is used. .box { } .box-heading { }
  • 126. a closer look at modules
  • 127. Guidelines The following ā€œmoduleā€ guidelines apply regardless of whether you are coming from OOCSS or SMACSS.
  • 129. ā€œ By making your base objects this simple your choices become boolean; you use the object or you donā€™t. The object is either entirely suitable as a basis, or entirely _un_suitable. ā€ http://csswizardry.com/2012/06/the-open-closed-principle-applied-to-css/
  • 130. Keep ā€˜em simple The base module should be deļ¬ned as simply as possible. This means that they are highly ļ¬‚exible.
  • 131. Letā€™s use an example of our ā€œrowā€ class. What if we added some padding to this rule? .row { ! clear: left; ! overflow: hidden; ! padding: 20px 0; }
  • 132. But what if we want a row that doesnā€™t have padding? The problem is that this rule is now very speciļ¬cally deļ¬ned. It is therefore not as ļ¬‚exible.
  • 134. ā€œ Any CSS that unsets styles (apart from in a reset) should start ringing alarm bells... Rulesets should only ever inherit and add to previous ones, never undo. ā€ http://csswizardry.com/2012/11/code-smells-in-css/
  • 135. Donā€™t undo Leading on from the ļ¬rst rule, you should avoid writing rules to undo a previous module.
  • 136. For example, what if you wanted almost all of your headings to have a border-bottom? h2 { ! font-size: 1.5em ! margin-bottom: 1em; ! padding-bottom: 1em; ! border-bottom: 1px solid red; }
  • 137. But in some cases you might want a heading without a border-bottom.
  • 138. You could write a new rule like this: .no-border { ! padding-bottom: 0; ! border-bottom: none; }
  • 139. This is not ideal. It is much better to write sub-modules that add styles, rather than write sub- modules to undo styles.
  • 140. So, a better way might be to write two rules like this:
  • 141. /* default style */ h2 { ! font-size: 1.5em ! margin-bottom: 1em; } /* only when border needed */ .headline { ! padding-bottom: 1em; ! border-bottom: 1px solid red; }
  • 142. Rule 3: extend but donā€™t modify
  • 143. Donā€™t modify Base modules can be extended using sub-modules. However, the base module itself should never be modiļ¬ed.
  • 144. This is based on the object oriented programming ā€œopen/ close principleā€.
  • 145. ā€œ Software entities (classes, modules, functions, etc.) should be open for extension, but closed for modification. ā€ http://en.wikipedia.org/wiki/Open/closed_principle
  • 146. If a based module needs to be modiļ¬ed to suit a speciļ¬c case, it is probably better to create a new module.
  • 147. Rule 4: think before adding new modules
  • 148. Donā€™t rush It is always tempting to add a module based on your need at the time... as well as based on the needs of the system.
  • 149. This often happens after the initial planning and build has been done. Itā€™s easy to be tempted by ā€œIā€™ll just drop this new class in at the bottom of my CSSā€.
  • 150. However, adding poorly structured new modules, without rigorous abstraction, will lead to bloated, hard-to-manage CSS.
  • 153. DocBlock There is a growing trend to use the DocBlock as an overall comment convention. In fact, a movement around this type of commenting began over 6 years ago with the CSSdoc group
  • 154. ā€œ "A DocBlock is an extended C++- style PHP comment that begins with "/**" and has an "*" at the beginning of every line. DocBlocks precede the element they are documenting... ā€ http://en.wikipedia.org/wiki/PHPDoc
  • 155. /** * Short desc * * Long description first sentence starts * and continues on this line for a while * finally concluding here at the end of * this paragraph * * The blank line above denotes a paragraph */
  • 157. Single line? In the early days of CSS, a lot of developers preferred single line CSS rules as they could easily see the selectors.
  • 158. Multi-line Today, with the complexity of individual rules, most developers seem to prefer either the multi-line format, or multi-line with indenting format.
  • 159. CSS Tricks rule formatting poll Multi-line Format with Indenting 44% Multi-line Format 28% Single-line Format 11% Single-line Format with Indenting/Tabbing 5% Mostly Single-line Format 5% Single-line Format with Tabbing 4% Other 3% *CSS-tricks poll: http://css-tricks.com/different-ways-to-format-css/
  • 160. .navigation_rss_icon { ! position: absolute; ! left: 940px; ! bottom: 0px; } #navigation_rss { ! position: absolute; ! left: 720px; ! font-family: Verdana, Arial, Helvetica, sans-serif; ! text-transform: uppercase; ! color: #897567; ! line-height: 2.5em; } #navigation_rss li { ! display: inline; } #navigation_rss li a:link, #navigation_rss li a:visited { ! color: #fffffe; ! text-decoration: none;
  • 161. .navigation_rss_icon { position: absolute; left: 940px; bottom: 0px; } #navigation_rss { position: absolute; left: 720px; font-family: Verdana, Arial, Helvetica, sans-serif; text-transform: uppercase; color: #897567; line-height: 2.5em; } #navigation_rss li { display: inline; } #navigation_rss li a:link, #navigation_rss li a:visited { color: #fffffe; text-decoration: none;
  • 163. Alphabet? Similarly, many developers used to prefer to sort their declarations alphabetically.
  • 164. Group Today, most people prefer to group their declarations by type.
  • 165. CSS Tricks declaration formatting poll Grouped by type 45% 45% Random - 39% 39% Alphabet - 14% 14% By line - 2% 2% *CSS-tricks poll: http://css-tricks.com/different-ways-to-format-css/
  • 166. .selector { /* Positioning */ position: absolute; z-index: 10; top: 0; right: 0; /* Display & Box Model */ display: inline-block; overflow: hidden; box-sizing: border-box; width: 100px; height: 100px; padding: 10px; border: 10px solid #333; margin: 10px; /* Color */ background: #000; color: #fff /* Text */
  • 167. Of course, many tools and pre- processors take care of this for you. If your tools do not have this capability, take a look at CSS Comb http://csscomb.com/
  • 169. Russ Weakley Max Design Site: maxdesign.com.au Twitter: twitter.com/russmaxdesign Slideshare: slideshare.net/maxdesign Linkedin: linkedin.com/in/russweakley