Add to Technorati Favorites

adbits - tell the world

1 Simple step to solve many problems

Votes: 295

I'll get right to it, the first thing I do when I start a css layout is add this line:

* { padding:0; margin:0;}

It's some simple and easy, but yet is solves so many headaches.  I've spent hours trying to debug a css layout, only to find out Internet Explorer, Safari, or Firefox  does something goofy to some element.  I'll pick on Internet Explorer here, why not everyone does these days - for good reason.  <form> in IE has margin (or padding not sure), why?  it's not even visable, that feature must have been added on a Monday .

Now some things to consider here, by using the wild card (*) we are telling the browser to check every single element in the page for padding and margin and remove it.  Doing this on faster systems it should be of no effect, but maybe on slower ones it might hurt performance.  My systems administrator here tells me don't worry about it, I have not conducted any tests, feel free to suggest some.  Anyway if your system suffers, you need a new one for vista anyway, or get a Mac. 

Write a comment

  • Required fields are marked with *.

If you have trouble reading the code, click on the code itself to generate a new random code.
Security Code: