- This topic is empty.
-
AuthorPosts
-
October 15, 2012 at 10:12 am #40302
ashapanka
ParticipantI am having a hard time pushing my footer to the bottom of the page, and not having it depend on the amount of content. I tried http://ryanfait.com/sticky-footer/, but it didn’t work. Below is my code, any help would be appreciated!
.container {
min-height: 100%;
height: auto !important;
height: 100%;
margin: 0 auto -42px; /* the bottom margin is the negative value of the footer’s height */
}#footer {
color: #ffffff;
float: right;
text-align: right;
bottom: 0px;
}#footer, .push {
height: 42px; /* .push must be the same height as .footer */
}October 15, 2012 at 10:13 am #111887ashapanka
Participantnote: “footer, .push” should be “#footer, .push”
October 15, 2012 at 10:16 am #111888Kitty Giraudel
ParticipantI’d go with absolute positioning. It seems accurate to me in your case.
#footer {
position: absolute;
left: 0;
right: 0;
bottom: 0;
}
October 15, 2012 at 10:36 am #111890chrisburton
Participant@HugoGiraudel Wouldn’t that put the footer at the bottom of the browser window, not below the content?
October 15, 2012 at 10:40 am #111892Kitty Giraudel
ParticipantIsn’t that the point?
October 15, 2012 at 10:46 am #111894ashapanka
ParticipantSorry, I should have been more clear. I have many pages on this site with varying amounts of content (some a couple words, some long paragraphs). My goal is to have the footer below the content, and at the bottom of the page.
October 15, 2012 at 10:52 am #111895Kitty Giraudel
ParticipantThen I confirm: I’d go with position: absolute.
October 15, 2012 at 11:02 am #111896chrisburton
Participant@ashapanka Is it me that’s not understanding what you’re saying?
Do you want this: http://grab.by/gLuc
or this: http://grab.by/gLum
October 15, 2012 at 11:02 am #111897ashapanka
Participantlook at this, you’ll see the problem: http://jsfiddle.net/sNtxg/
October 15, 2012 at 11:03 am #111898ashapanka
Participantbingo! http://grab.by/gLum is what I need…I can’t have my footer overlap content.
October 15, 2012 at 11:04 am #111899chrisburton
ParticipantThat’s what I figured. I’m having the same issue on my upcoming site which I haven’t been able to figure out as well. I hope someone else can help you.
October 15, 2012 at 11:04 am #111900Paulie_D
MemberYou need to add 100% height to the body and html.
October 15, 2012 at 11:37 am #111903ashapanka
ParticipantThanks! I actually already added this line to my css (forgot to mention it above) but the footer is still right below the content, rather than pushed to the bottom. Is there something that can be undoing this style?
October 15, 2012 at 11:39 am #111904Paulie_D
MemberIt’s working in the Fiddle so something else must be going on.
Without seeing a live site it’s difficult to comment.
October 15, 2012 at 11:47 am #111908ashapanka
ParticipantI understand. I did some research and it looks like adding “clear: both; ” to the footer might fix my problem.
-
AuthorPosts
- The forum ‘CSS’ is closed to new topics and replies.