Some time ago I was looking to put header and footer fixed at the top and bottom of the page, respectively, adjusting to the content that would be between the two, and I got with the following code:
CSS:
#wrapper {
min-height: 100%;
position: relative;
}
#container {
background: red;
padding-bottom: 80px;
overflow: hidden;
}
#content {
background: blue;
width: 1000px;
margin: 0 auto;
}
header {
height: 52px;
background: black;
}
header div {
width: 1000px;
background: red;
height: 52px;
margin: 0 auto;
}
HTML
<div id="wrapper">
<div id="container">
<header>
<div></div>
</header>
<div id="content"></div><!--content-->
</div><!--container-->
</div><!--wrapper-->
I would like to know how, by using this code, I can set the header at the top when scrolling, but keep the structure of content and footer . >