7 Principles Of Clean And Optimized CSS Code
smashingmagazine.com
smashingmagazine.com
margin: { 10px 20px 30px 40px; }
lol, wat? that's not even proper syntax.Good intentions and a few good practices, but not a great understanding of the deeper issues involved in maintaining stylesheets for large sites with multiple contributors.
I would add :
- Automate rollups and minification as a part of the build process
- Outline the structure of the CSS in comments at the beginning of each CSS document.
- Don't worry about whitespace cause you're going to minify it anyways.
- Browser-specific CSS files can work against you.
- Well written CSS often requires little documentation. Focus on creating attributes that make sense. Nobody wants to RTFM.Does that really happen? Are conditional comments and CSS hacks really absolutely necessary? I've done a fair bit of CSS drudge work, including for some moderately complicated layouts (and hated every moment of it), and never resorted to either. There always seems to be a better way if I think about it hard enough.
The tips were ... eh.
But I did really really like the graphics that he used in his examples, with a page from the site folding back to reveal the code underneath. That was sexy.
EDIT: Hell, all the JS for the photo gallery at [http://davidmckayphotography.com/], combined, is just a shade over 30KB, and it does some fairly heavy lifting. I really hope the guy was kidding about 30K of CSS.