I'm trying to understand a few things.
First question:
Why there is a margin-top on the body?
html {
height: 100%;
background-color: red;
}
body {
height: 100%;
margin: 0;
background-color: yellow;
}
<h1>Hello Plunker!</h1>
If I look with dev tool inspector in Chrome, it shows me that the h1 top margin starts outside the body top margin (picture shows the h1 highlighted):
Second question:
In the next example, why does the yellow color is drawn outside the body?
I expected to see yellow color only within the body element, given that I set overflow property:
body {
height: 100px;
background-color: yellow;
margin: 0;
overflow: hidden;
}
Third question
If I add a background-color on the html element, it works, the yellow color fills only the body element, why?
html {
background-color: red;
}
body {
height: 100px;
background-color: yellow;
margin: 0;
overflow: hidden;
}
