Reset all Margins & Padding

Avatar of Chris Coyier
Chris Coyier on (Updated on )

DigitalOcean provides cloud products for every stage of your journey. Get started with $200 in free credit!

* {
margin: 0;
padding: 0;
}

This has become a very popular technique lately, and for good reason. It removes all default margin and padding for every object on the page, no holds barred, regardless of browser. This provides a nice clean slate for design and ensures that all spacing is intentional, explict, and ubiquitous across browsers. There is no reason not to do this.

Some people like to include border: 0; as a part of it, but it has been found to not be effective in all situations (including the annoying borders>, so why bother…

If you wanted to go completely bat poop crazy on reseting every possibly everything, check this out.