.NET Tips and Tricks

Blog archive

Free Tool: Don't Reset Your CSS, Normalize It

Standards must be wonderful things; after all, there are so many of them. And there's a different standard for CSS defaults for every browser. As a result, if there's any relevant CSS setting that you don't supply a value for in your CSS, your perfectly good stylesheet will cause your page to display "uniquely" in every browser (and unique is never good).

The typical solution to this problem is to use a "CSS Reset" stylesheet, which shoves a value into every CSS setting (margins, line heights, font size) that might matter to you. But CSS Resets just steamrolls over the defaults, setting all numeric values to 0 or 1. It's a "zeroing out" approach. Since those "zeroed out" settings probably aren't what you want, you have to write a lot more CSS to provide values for those defaults.

Normalize.css takes a different approach. Rather than make every browser look like nothing, Normalize tries to make every browser look the same. Normalize.css attempts to support the browser defaults that are actually common, and bring those browsers that don't use those common defaults around to those defaults. So, for example, Normalize ensures that superscripts and subscripts use the same font-size and line-height in all browsers rather than zeroing those values out and forcing you to specify them. You can argue with the defaults the authors have chosen as "common," but they have drawn on the specifications established by a number of industry groups, including WHATWG (the people who brought you HTML5).

From a user interface design point of view, this is a two-edged sword. Users value consistency in their UIs more than anything else. Normalize.css will make your pages look alike across all browsers. But it also means that when your page is displayed in Chrome, your page may not look like every other Chrome page. I'm OK with that, but you're free to disagree.

Normalize.css is up to date with HTML5, understands mobile browsers, is easy to add to your project, and is well documented so that you know what it's doing (and why). It's not even very big. It should be the start point for all of your styling.

Posted by Peter Vogel on 07/30/2013


comments powered by Disqus

Featured

Subscribe on YouTube