Dave Woods - Freelance Web Design Warwickshire

Quick tip: Reset Padding and Margin

Each browser has it’s own default rules and when it comes to padding and margin’s it can cause havoc when creating the CSS for a website.

However, there is a simpler solution than trying to change the code for each indivdual element that’s causing problems.

Using the following code at the start of a CSS document will set all padding and margin’s to zero and give you a consistent starting point.

* {
padding: 0;
margin: 0;

5 comments on “Quick tip: Reset Padding and Margin

  1. Pingback: Dave Woods » Creating a Simple CSS Layout

  2. Dave Post author

    I believe * html #style only works in IE but the * selector is supported in all browsers.

    I’d recommend using conditional comments where required though to get around the bugs in IE6 and lower instead of using hacks.

    IE7 despite not being completely standards compliant, shouldn’t need any hacks.

  3. shaka

    i just bought css and i uploaded it to my pc and it is competly up but when i click to play it ,i just get a black screen and then this comes up

    the instructio at “ox10743e2c” referenced memory at “0x0e54a1ao”. the memory could not br “read”

    can you help me please????

  4. Dave Post author

    Hi Shaka, I’m sorry but I think you’re talking about a completely different CSS to the “Cascading Style Sheets” which is discussed here?