Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Css align to bottom of page

Tags:

css

I want my footer to always be on the bottom and move to adjust to the size of the content inside the page. Right now I have dynamic content that covers the footer because it's to much content.

How can I fix my CSS:

div#Footer {
  width: 100%;
  height: 80px;
  padding: 1px;
  -moz-border-radius: 35px;
  border-radius: 35px;
  background-color: Black;
  color: #ffffff;
  position: fixed;
  bottom: 0;
  text-align: center;
  margin-left: auto;
  margin-right: auto;
}
like image 851
CsharpBeginner Avatar asked Jan 19 '12 16:01

CsharpBeginner


People also ask

How do I align items to the bottom of a div in CSS?

To align the div content to the bottom, use position: relative to the container class and position: absolute to the div element.


3 Answers

This is a simpler solution.

#footer {
    bottom: 0%;
    position: fixed;
}
like image 50
Jacob Gunther Avatar answered Nov 13 '22 19:11

Jacob Gunther


This has been asked countless times, you are looking for a Sticky Footer.
Simply follow the link there, this is a well known technique and they offer all the source code there.

like image 24
Jakub Avatar answered Nov 13 '22 19:11

Jakub


Its a little unclear what you want but this code has worked well for me.

Credit - http://css-tricks.com/snippets/css/fixed-footer/

#footer {   
   position:fixed;
   left:0px;
   bottom:0px;
   height:30px;
   width:100%;
   background:#999;
}

/* IE 6 */
* html #footer {
   position:absolute;
   top:expression((0-(footer.offsetHeight)+(document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body.clientHeight)+(ignoreMe = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop))+'px');
}
like image 26
megaSteve4 Avatar answered Nov 13 '22 18:11

megaSteve4