CSS Reset

I’ve been reading, to my surprise, the positive reactions on resetting or rather zeroing CSS for crossbrowser conformity. I’ve had pretty much the opposite experience when I started writing resets years ago. A lot has changed since then so taking another look at the technique is certainly worth it. Especially when you consider the fact that by the end of 2008 we won’t need level A support for Internet Explorer 6. However, one must keep in mind that the inherent problems with resetting remain.

So what’s the problem with resetting? Resetting or zeroing as can be seen in Eric Meyer’s reset example leads to superfluous code.  You’re going to have to give html selectors a certain value at some point. This begs the question why not set these values from the start via patterns. That in of itself can be the reset.

More often than not someone will have to go back into the CSS to add or change something. Even though crossbrowser differences exist there is a certain amount of expectation of screen rendering. There plenty of conventions that are respected by all browsers. Zeroing does away with all that. When the most common tags have been reset/zeroed all the tags with a higher specificity will need to set the values again. Unless you rewrite the reset tags with particular values at that lowest specificity. Why normalise the font weight of a <TH> when that is a pretty common and convenient convention. Especially for those not so familiar with CSS. Messing around with lay-out, and style only issues like colour is fine. But when you start messing around HTML conventions aimed at the core content themselves you have to be very careful. You have to at least set the effected tags to some kind of convention. Zeroing isn’t a convention, it’s removing a convention. Zero is nothing, a mathematician once told me.

Paragraphs are block elements with a clear behaviour. Paragraphs stacked always show empty line between them. Lists always have some kind of marker, the common default being ‘disc’.
So if you do reset your CSS remember to set these again to that they don’t appear to be broken. Unless you write a container block for user generated content that is inserted by a CMS. Writing for the unknown is asking for trouble.

Okay, I’ve got that out of the way I can safely say that Eric’s reset does have some little gems. Like setting vertical align to baseline and outlines to zero. Very nice additions, and ones I keep forgetting to add to my patterns. Zeroing is something I’ll never do, and something I’ll never let my team do. The more code we need to add the more mistakes we’re going to make and the more debugging we’ll need to do.  From the outset it’s great, in the long run it’s a bitch.