The most important CSS rule

I thought I’d share the CSS rule that’s most important to me (at least for the moment). Here goes:

*{
	margin: 0;
	padding: 0;
}

Why do I love it? Since the universal selector (*) applies to all elements in the web page, hence removing all unwanted margins and paddings and helps me getting rid of inconsistent space and rendering in different web browsers and platforms. From there on, I totally control how code will handle every aspect of space (well, almost, form elements are still hell…).

I think the first place where I saw it was Eric Meyer’s web site, but I’m not sure of who wrote it first.

So if you aren’t using it already, I really recommend trying it out!

Posted in CSS

19 Comments

Leave a Reply to Saeid Zebardast Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.