Structure CSS Files

Page content
Sometimes we forget that CSS is actually code. Usually it is just thrown together as an after thought because we simply one a few styles here and there. However, anyone who has dealt with CSS files over 100 lines long knows that just throwing together tags in a wild maylay is not the way to go.

CSS code should be laid out and structure just like any other code we write. Emil at Friendly Bit has a detail article on how to structure large CSS files. He mentions five (5) main methodologies:

  1. Order your selectors like the HTML
  2. Always use the “full path to elements
  3. Indent your code cleverly
  4. Each declaration on its own line
  5. in alphabetic order