html,
body {
height: 100vh;
}
body {
margin: 0px;
}
footer {
height: 50px;
}
.page-wrap {
width: calc(100% - 100px);
height: calc(100% - 100px);
position: relative;
background: black;
top: 0;
left: 0;
margin: 50px;
}
.content {
min-height: calc(100% - 50px);
}
<div class="page-wrap">
<header>
</header>
<div class="content">
</div>
<footer>
</footer>
</div>
Using this code the body is consistently taller than the viewport, but why? I also see that setting any margin on the .page-wrap
seems to create a scrollbar on body even though the height of .page-wrap
is set to (calc: 100% - 100px);
- I think I should have 100px of margin before a scrollbar appears, but even 1px will cause the body to become longer than the viewport..