Remove default padding and margins
September 3rd, 2005 | Filed under Code snippets, CSSMost web browsers add default padding and/or margins to certain HTML elements; for example, and unstyled <body> or <p> will have space around it, depending on the browser. To start with no padding or margins, begin your CSS stylesheet with the following:
* { margin:0; padding:0; }
From there explicitly add padding and margins to elements in your stylesheet by declaring CSS classes as usual. See an unstyled page with default padding. Compare it to a page with unpadded elements including the CSS bit above.
Update: Kevin Hale’s quick start CSS templates include the * element above with font-family and font-size, too.