Good CSS practices to get into.
I just got around to reading an article I bookmarked a while back on webdesignerdepot.com to help improve your CSS code. It's a good read, I highly recommend it.
Here's a little synopsis:
Stay Organized
Use a logical structure in your code. Declare broadest items first, and get more specific as you go. The author recommends:
- Resets & overrides
- Links & type
- Main layout
- Secondary layout structure
- Form elements
- Miscellaneous
I am guilty of NOT doing it like this, but I will make an effort to start!
Title, date and sign
Include contact info so others can get a hold of you if they need help. I'm not sure how I feel about this. If someone needs help with the code, it's obviously not the author. What's my incentive to help someone else get paid to edit the code I wrote?
One little bit included in this section which I did find helpful was adding color "swatches" in the form of commented color hex codes at the top. I constantly find myself jumping from Dreamweaver to Photoshop to grab this info. Sticking it in the CSS would be a HUGE benefit to me.
Keep a template library
Strip out all site specific CSS from your next project, and use it as the start of your template library. Most developers carry certain elements of their sites from project to project. Don't re-write it every time. For example, all my sites are centered, and I like them pinned to the top of the browser. Also, I'll never see why image links get borders by default. My generic template would include these items.
- ebrouwer's blog
- Login or register to post comments

