Monday, November 27th, 2006

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

Popularity: 3%



Related Posts

  • None Found
  One Response to “Structure CSS Files”


Leave a Reply (I Follow)