I have this simple html/css-code:
<html>
<body style="margin: 0;">
<div class="container" style="height: 100vh; min-height: 100vh; background-color: purple;;">
<div class="child" style="height: 20px; background-color: palegoldenrod; margin-top: 10px;"></div>
</div>
</body>
</html>
I thought the padding-top
applied to the .child
element would push it down 10px from the top of the .container
-div (which is as high as the viewport).
But instead it leads to the .container
being pushed down (actually the entire body is being pushed down) by these 10px, given that I never applied a margin to the body
nor the .container
.
Probably it is very simple, but I just was just a little surprised...
Here is a codepen with that code: https://codepen.io/robinkohrs/pen/BaGabyp