How (Mostly) Not to Write your CSS
I’m going to depart from my normal routine of pointing out really good resources. This time I’m going to point you to a resource that, :IMO:, generally has pretty poor advice about how to write a good stylesheet. Writing Perfect Style Sheets is supposed to give you tips on how to improve your own :CSS:.
Unfortunately, there’s really only one tip in there that I think is worth following and that would be the information about the base style sheet. The basic idea being that you should set, at the very beginning of your sheet, some basics for all the main (X)HTML elements even if you generally don’t use them. Good advice that I should really follow myself. Don’t follow it blindly, though, since you should be defining the element names all in lowercase if nothing else.
The rest of the advice in the article isn’t particularly useful in my experience. I used to organize my sheets as they suggest and had nothing but trouble. Now I put mine into sections: base styles, general decoration, and a section for each main area (header, footer, etc.). They say that instead of combining tags together when you can that you should write out each one separated and in full. Um, yeah, right… and lose so much of the power of CSS in the process?
See, folks… not all the advice out there is good—even that advice coming from supposedly knowledgeable sources. Heck, I don’t necessarily know what I’m talking about all the time, either, for that matter!
Posted Friday November 14, 2003 in (X)HTML and CSS by Chris Curtis
This is an older entry and as such, it may be by a guest author or contain formatting problems / extraneous code. If you notice something wrong with the entry, please use the Contact page to let me know the entry title and issue.