Jonathan Snook has posted a few great CSS coding tips in Top CSS Tips. Several of them come down to personal preferences, and it seems my preferences differ a bit from Jonathan’s in some cases, so I thought I’d go through his tips and note my take on each of them.
px for font sizes
Jonathan’s arguments for using px make sense, but I always use em. I’ve learned how to use a combination of percentages and ems and feel comfortable sizing text that way.
CSS declarations on one line
Unlike Jonathan I use a single line for rules that only contain one declaration, but multiple lines for rules with multiple declarations. TextMate’s code folding takes care of the rest for me. Jonathan makes a valid comment about file size savings with single line declarations though.
Blocking the Styles
I do pretty much the same thing: first element declarations, next global classes, and finally the layout containers and sections.
Read More Article...
Showing posts with label CSS Writing Tips. Show all posts
Showing posts with label CSS Writing Tips. Show all posts
Thursday, October 16, 2008
Useful tips for writing efficient CSS
Labels:
CSS,
CSS coding tips,
CSS Writing Tips
Subscribe to:
Posts (Atom)