I'm working on a project and I'm trying to get the footer to stay at the bottom of the page but out of sight until you scroll to the bottom of the page. I tried using a 'position: fixed' in my CSS but it floats above my content, for absolute it stuck to the middle of the page and covered content. Also, for pages without much content when I don't specify the position or I use 'position: absolute', there is whitespace below the footer. Please provide suggestions.
* {
margin: 0;
padding: 0;
}
header {
background-color: gray;
}
footer {
background-color: gray;
bottom: 0;
height: 20px;
position: fixed;
width: 100%;
}
/* when I use the fixed position, the footer is fixed above my content. What I want is for the footer to remain at the bottom of the page but out of sight. */
<html>
<body>
<header>Heading</header>
<main>
<h1>Heading</h1>
<p>Lorem ipsum dolor sit, amet consectetur adipisicing elit. Adipisci eos deserunt fugiat doloremque your text`ut.</p>
</main>
<footer>© Copyright, Business</footer>
</body>
</html>