Hi. I'm Andrew

« Back to blog

What goes wrong with CSS

  1. CSS grows with site size. Depending on your site, this can be a serious issue — not just for performance, but because CSS is code. More code tends to lead to more problems — maintaining code size is a serious concern.
  2. CSS best practices encourage what would otherwise be bad programming: repetition, bad grouping, loose coupling. Again, if you treat CSS as code that needs to be maintained, reviewed, and refactored, these are negatives.
  3. CSS is often contextually unreadable. For example,.about .main ul li li amight be very clever CSS, using a nesting in the markup to trigger a style, but it’s very bad code — without a strong understanding of the HTML, this code can be ambiguous, and its HTML target hard to pinpoint.
  4. CSS encourages overrides, which are the death toll for maintainability. The more styles you override, the more styles you will eventually have tooverride again.
  5. CSS encourages bad coupling and distant dependencies — for example, let’s say all LIs inherit a margin-bottom we set early in the CSS, and the features we code design with this spacing in mind. Despite the fact that the art director says a particular feature MUST look the way the comp looks, said feature now depends on a very remote line of code, a line that anyone might change without realizing the consequences.

Found at Viget.com, CSS Strategy Square-off.

The approaches highlighted, OOCSS & SMACSS, in the article are also what I consider to adapt going forward with CSS development/authorship. 

 

0 Comments

Leave a comment...