If I understand correctly, you have several elements with height: 100vh, and the problem is that their contents can overflow them.
In this case you can
Use the property overflowto properly handle overflows.
For example, it overflow: autowill add scrollbars only if necessary.
html,body {
margin: 0;
}
section {
height: 100vh;
overflow: auto;
background: yellow;
}
section + section {
background: lime;
}
div {
height: 150vh;
margin-left: 15px;
border-left: 1px dotted;
}
<section>
Start<div></div>End
</section>
<section>
Start<br />End
</section>
Run codeHide resultUse min-height: 100vhinsteadheight: 100vh
, , , .
html,body {
margin: 0;
}
section {
min-height: 100vh;
background: yellow;
}
section + section {
background: lime;
}
div {
height: 150vh;
margin-left: 15px;
border-left: 1px dotted;
}
<section>
Start<div></div>End
</section>
<section>
Start.<br />End
</section>
Hide result