Friday, April 14, 2006
Leave spaghetti to the Bolognese
From Unofficial Office Stuff
Tom Fadial has an excellent web site mostly exploring philosophy.
The seventeen year old University of Buffalo student also has a collection of tips about how to make sense of the mess that CSS can sometimes appear.
Here are five headings, be sure to go to his site to see the documentation.
1) Indent descendant (sic) and related rules.
2) Use shorthand properties to keep all parts of a style type on a single line.
3) Clearly divide your stylesheet into specific sections.
- Global Styles - (body, paragraphs, lists, etc)
- Header
- Page Structure
- Headings
- Text Styles
- Navigation
- Forms
- Comments
- Extras
4) Define the basic rules for each area only once so that the same default value is not being rewritten in every rule. If you know that all of the h2's will not have a margin or padding, define that on the top level and let its effect cascade as it is supposed to.
5) The easiest method is to combine all of the tips above to move the base styles for all elements into a separate section of the stylesheet or a separate stylesheet altogether.