Click here to Skip to main content
15,887,379 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'm trying to position my footer at the bottom of the page in my cart page, and I made this a sticky footer, but it keeps going up, like higher than the middle. Example:

Page Image

How can I fix this?

Thank you!

What I have tried:

I've tried looking it up and I copied and pasted the code from Chris Coyer's sticky footer. (I did the last one. I've already looked at the other ones, but they had didn't help either.
Posted
Updated 23-Nov-20 19:45pm

You could ask Chris coyer about his code, or look at How To Create a Fixed Footer[^].
 
Share this answer
 
Comments
h311o 23-Nov-20 7:19am    
That works, except how do I make the footer just positioned at the bottom, without having it in sight while scrolling?
Richard MacCutchan 23-Nov-20 7:29am    
Sorry, I don't know, I have not tried it myself.
h311o 23-Nov-20 8:31am    
@Richard-MacCutchanWatch oh, right. Thanks for your help anyway :D
The flexbox solution works fine for me:
CSS
html, body {
    min-height: 100vh;
}
body {
    display: flex;
    flex-direction: column;
}
#page-footer {
    margin-top: auto;
}
Demo[^]
CSS Flexible Box Layout - CSS: Cascading Style Sheets | MDN[^]
A Complete Guide to Flexbox | CSS-Tricks[^]
 
Share this answer
 
Comments
h311o 24-Nov-20 1:57am    
@RichardDeeming it doesn't work though...
Richard Deeming 24-Nov-20 1:58am    
It does work though...

If you want help, you're going to need to provide some proper details.
h311o 24-Nov-20 3:02am    
Sorry, this is my style.css:

https://ibb.co/ftNDkXy

This is my cart page:

https://ibb.co/wJMFqSY

And my footer.css:

https://ibb.co/pzBqxXh
Richard Deeming 24-Nov-20 3:09am    
I can't see the markup of your page, only the output.

I notice you have the footer set to grow (flex: 1 0 auto;) which means it will take up any available space within the flex container. Try removing that line.
h311o 24-Nov-20 3:19am    
Thanks for replying!

I commented that line out but it didn't make any difference.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900