html - How to change color below browser window to match footer -


below have footer, dark purple color. see here when scroll past end of footer however, white. how change white match footer color, without changing background color of content have top?

i want color show when user attempts scroll past footer, not anywhere else in document (or when user attempts scroll above nav example).

using html {background-color: purple} colors entire document including top, want color show @ bottom.

using html {background: linear-gradient(white, purple)} leaves gradient stretched across entire page more importantly shows purple @ top , white @ bottom.

edit (better example)

consider https://codepen.io . visit homepage. now, when attempt scroll above navigation bar, shows dark grayish color. when attempt scroll below footer, shows dark grayish color. want show color when user scrolls past footer only, not navigation.

it sounds though problem comes having 2 types of content; defined section of content has own background colour, , undefined content sitting directly on body. assume looks this:

body {    margin: 0;    background: yellow;  }    .content {    height: 1900px;    background: white;  }
<body>    header content    <div class="content"></div>    footer content  </body>

notice how if change colour of 'header', footer also change colour. you're trying solve linear gradient, problem isn't colour @ all; it's layout.

what want break each section of content own <div>. way, can style each section individually, allowing set different colour both header , footer:

header {    height: 50px;    background: yellow;  }    .content {    height: 1000px;  }    footer {    height: 50px;    background: purple;  }    body {    margin: 0px;  }
<header></header>  <div class="content"></div>  <footer></footer>

note if you're able scroll past footer on websites, may coming fact mobile phones can 'swing' bottom on scroll effect. 'extra' content does not exist, , whitespace generated phone trying 'catch up' bottom of page is.

you can control that colour setting colour background attribute directly on html. long of 'actual' content overriding colour set in html, can set colour whatever you'd like. however, it's not needs worried about, , can safely left default white.

hope helps! :)


Comments

Popular posts from this blog

python Tkinter Capturing keyboard events save as one single string -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

javascript - Z-index in d3.js -