Reputation:
I'm having a bit of CSS trouble with some banners.
I have two banners (not sticky) at the top and bottom of the page, the top banner works like a charm. I am having issues with the bottom banner.
The banner is not at the bottom of the page; here's what I've tried.
<div>
in the <footer>
tag - that didn't work.position: relative;
- now this sets the banner to the bottom of the page - but it doesn't extend the banner through all of the page and puts some kind of margin on the sides.Here's my CSS:
div#bannerbtm {
position: absolute;
bottom:0%;
left:0;
-webkit-animation: gradient 10s linear infinite alternate both;
animation: gradient 10s linear infinite alternate both;
width: 100%;
}
div#bannertop {
position: absolute;
top: 0;
left: 0;
-webkit-animation: gradient 10s linear infinite alternate both;
animation: gradient 10s linear infinite alternate both;
width: 100%;
}
and, here's the relevant HTML:
<body>
<div id="bannertop">
<div id="banner-content"></div>
</div>
<div> <!-- Page Content --> </div>
<div id="bannerbtm">
<div id="banner-content"></div>
</div>
</body>
Thanks in advance for any and all input; this has been driving me nuts.
Upvotes: 1
Views: 120
Reputation: 6760
Add this, so you banner will be absolute
inside relative
body.
html {
height: 100%;
}
body {
min-height: 100%;
position: relative;
margin: 0;
padding: 0;
}
Upvotes: 0
Reputation: 11210
The problem is that your body
and html
elements are not actually the full height of the page. The following css will ensure that your body tag is always at least the height of the screen, thereby ensuring that the bottom banner is at the bottom of the screen.
body {
min-height: 100vh;
}
Upvotes: 1