The following rules must be followed:
- The CSS must be valid conform CSS 2.1 specification. This can be tested using the W3C validator
- don't use inline style declarations
- don't hard code colors in proprieties - use ColorTheme attributes
- test your code on at least 3 browsers (IE, FF, Safari)
The following recommendations could be followed:
- Proprieties:
- alphabetical order;
- 2 spaces indentation;
- use of CSS shorthands;
- use relative sizes (em, %) instead of fixed ones (px);
- use appropriate CSS files for writing IE rules;
- limit as much as possible the number of IE hacks used.
- Organization:
- comment headers for separation and grouping of different parts of the code;
- Overwriting Localization:
- "Overwrites" and "Should be in" comments for dependencies overwriting;
= Tools =
CSS Optimizer and CSS Compressor are two excellent online tools that can shrink CSS.