Search code examples
htmlcssscrollborderredraw

Redraw page border on scroll


My webpage content is centered in the middle using auto margin and has a black border on both sides (left and right).

If I scroll down, the border doesn't update. So if I scroll down a bit the border will only reach half way down. How do i fix this?

Edit: The height of the content div is set to 100% and on initial load the border does go all the way down, this problem only occurs when scrolling.


Solution

  • The height of the content div is set to 100%

    This is likely your problem. Because you've set the div to height: 100% it's only as tall as the viewport. (Even though the content overflows out of it.)

    Try: min-height: 100%