Why in this snipped the scrollbar shows up?
I see that body is 100% tall as indicated by CSS, but it is not positioned at the top of the page. Instead, the margin from the h1 tag is pushing body down by that amount, resulting in the scrollbar because the body does not fit in the page.
html, body {
margin: 0;
padding: 0;
height: 100%;
}
.root {
height: 100%;
}
<div class='root'>
<h1>Test</h1>
</div>
My question is.. if the margin is in the h1 tag and h1 is inside body, why does body get pushed down and the scrollbar shows up?