3

I want to design a footer such that it should be at bottom of the webpage when there is less content in the body and should be pushed down if the content of the body reaches to footer.
If I do like this

 footer{
   position: absolute;
   bottom: 0;
   width: 100%;
 }

It doesn't go down if the body content increases.How can I do that?
please help me. Thanks in advance.

2 Answers2

3

Here's a working jsfiddle

You can use padding-bottom: with the same height of your footer to achieve the effect:

#body {
   padding:10px;
   padding-bottom:60px;
}
fnune
  • 5,256
  • 1
  • 21
  • 35
0

Change your position to "relative". When you use "absolute" you fix it to a particular position which in this case is at the bottom the startup screen. Using relative will position the footer relative to other elements on the page. If other element change their position, so is the footer.

Stephen Kennedy
  • 20,585
  • 22
  • 95
  • 108