-4

I'm trying to figure out how to get the footer to stick to the bottom of the page in the css of http://bit.ly/138xOAB

I've tried alot of things which were said in tutorials, such as:

  • the position absolute,
  • bottom:0,
  • and min-height of the container 100%,
  • height of the body 100%,

But none of those things turned out well.

You can see the HTML and CSS by inspecting the website. I can't get the proper code over here.

Can someone help me, maybe there is something wrong in the HTML?

Gerwin
  • 1,572
  • 5
  • 23
  • 51
HugOnline
  • 1
  • 3
  • `You can see the HTML and CSS by inspecting the website. I can't get the proper code over here.` You can always copy the relevant code from the element inspector. Or right click->view source.. – SW4 Dec 17 '14 at 08:15
  • There are so many [sticky footer posts](https://stackoverflow.com/questions/27417878/css-maintain-page-height/27418284) out there... – SubjectCurio Dec 17 '14 at 08:18
  • remove position:absolute from your footer. Or if you want footer to be shown all the time, then use position:fixed and appropriate margins/paddings as for your needs – trainoasis Dec 17 '14 at 08:18

2 Answers2

0

The problem with you footer's position: absolute; is that it will hide the other elements behind it.

Your footer can be best viewed if you remove position: absolute; so as to show all elements and add margin-top: 20px; for some gap in between the footer and the element before it..

Try it.

EDIT:

If you want the footer to be always float on the screen, use the following CSS (comments inline):

.container {
  max-width: 1200px;
  margin: auto;
  padding: 0px 3%;
  margin-bottom: 250px; /* so that all content is visible */
}

.footer {
  background: #efefef;
  position: fixed; /* so that the footer floats */
  overflow: auto;
  bottom: 0px; /* float at bottom */
  padding-top: 20px;
  padding-bottom: 20px;
  height: 180px;
  width: 100%;
  margin-top: 20px;
}
Rahul Desai
  • 15,242
  • 19
  • 83
  • 138
0

Remove "position: absolute" and "bottom: 0" from the .footer class. I think that fixes your issue. And add a small margin above the footer so there is a small space between the content and the footer.

Image

Vishnu M.
  • 971
  • 1
  • 10
  • 18
  • Thanks, but when you take a look at another page, registration for example, you see the footer floating instead of pushed down. – HugOnline Dec 17 '14 at 08:35