justinw justinw - 6 months ago 23
CSS Question

Keep footer at bottom but not sticky?

My basic layout is simple:


If I make my footer
it does stay at the bottom of the page, but is a "sticky" footer and covered content when scrolling is needed.

I would like to keep the footer at the bottom, but not be

Is this even possible to do with pure css?


Answer Source

There is position:absolute;. This Is a CSS property that allows you to control the exact location of any element. For example:

footer {
left: (numberofUnits)px;


This makes it so no matter what happens to the page, it stays in place, kinda like fixed only more specific. Though I think what you will really need is position:relative; So it adjusts the footer relative to other elements on the page. To incorporate that, I've added some other useful styles you might want to consider adding... (found these on www.w3schools.com) I hope this is what you need:

footer {
    clear: both; //prevents floating elements from right/left of footer
    position: relative; //Positions footer relative to other elements on hte page
    z-index: 1; //z-index positions elements in front or behind eachother, most have a //natual z-index of -1
    height: -3em; //exactly what it says...
    margin-top: 40em; //moves footer to bottom of all elements

Hope this Helps!

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download