Question on <body> tag's style

Hi hope everyone is alright,
I am working through the Site point book (very helpful) So why add

PADDING: 0;

styles for

<body>

when the default style for body is just

MARGIN: 8px;

Because the padding already set by default at zero? Something to do with different browsers applications out there?:cool:

More Info

Each browser has its own defaults, so to account for them all, there are resets like the above. Perhaps not every element needs zero padding and margin, but it’s easy enough just to include them all in the one rule. I’ve never used a browser that had any default margin or padding on a div, for example, but I hear there is (or was) such an one.

There is no set default style sheet for browsers makers to adhere to and they can use whatever they wish and although they are encouraged to standardise it is not a requirement.

Newer versions of browsers are tending to be closer in their defaults but there is no guarantee. Previously some browsers used margins on html and some like opera used padding and some like IE applied styles to the body element instead.

Therefore the standard practice for old and new browsers is simply to zero margins and padding on html and body e.g. html,body{margin:0;padding:0}.

There are many other anomalies such as the default space for bullets on lists which some browsers use padding and some use margin so you need to address both.

It would be nice if all browsers used the same measurements but then why would you want a browser telling you how much margin to apply. It’s your job as a designer to set the requirements for your layout that you need.:slight_smile: