Throughout my years in development, I have primarily focused on front-end web UI development. One recurring issue that has always irked me is the constant need to reset default browser styling assumptions, which often slips my mind until it starts affecting my page layouts.
One of the most common assumptions made by browsers is the default 8px margin applied to the HTML <body>
element.
I've always wondered about the rationale behind this default margin. It's almost become standard practice to include CSS rules like the following to remove this unwanted margin:
html, body
{
margin: 0px;
padding: 0px;
}
In my opinion, it would make more sense for developers to start with a clean slate and adjust the layout as needed. The default margin around the body element forces designers to be mindful of spacing and add extra code to ensure proper layouts when they forget to reset these defaults.
What was the reasoning behind the decision to apply this default margin to all body elements in early HTML browsers or the initial HTML spec?