Better CSS

CSS Architecture – In depth post on bad and good CSS. Some points -

  • Good – Predictable, Reusable, Maintainable, Scalable
  • Bad Practices – modifying components based on who their parents are, overly complicated selectors, overly generic class names, making a rule do too much

    All of the above bad practices share one similarity, they place far too much of the styling burden on the CSS.

  • Advice

    The best approach that I’ve found is for the CSS include as little HTML structure as possible. The CSS should define how a set of visual elements look and (in order to minimize coupling with the HTML) those elements should look as they’re defined regardless of where they appear in the HTML

  • HTML Inspector
    CSS Lint – tool to help point out problems with your CSS code
    CSS Lint Source Code