Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS need footer pushed to bottom of page

  • This topic is empty.
Viewing 15 posts - 1 through 15 (of 17 total)
  • Author
    Posts
  • #40302
    ashapanka
    Participant

    I 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 */
    }

    #111887
    ashapanka
    Participant

    note: “footer, .push” should be “#footer, .push”

    #111888
    Kitty Giraudel
    Participant

    I’d go with absolute positioning. It seems accurate to me in your case.

    #footer {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    }
    #111890
    chrisburton
    Participant

    @HugoGiraudel Wouldn’t that put the footer at the bottom of the browser window, not below the content?

    #111892
    Kitty Giraudel
    Participant

    Isn’t that the point?

    #111894
    ashapanka
    Participant

    Sorry, 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.

    #111895
    Kitty Giraudel
    Participant

    Then I confirm: I’d go with position: absolute.

    #111896
    chrisburton
    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

    #111897
    ashapanka
    Participant

    look at this, you’ll see the problem: http://jsfiddle.net/sNtxg/

    #111898
    ashapanka
    Participant

    bingo! http://grab.by/gLum is what I need…I can’t have my footer overlap content.

    #111899
    chrisburton
    Participant

    That’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.

    #111900
    Paulie_D
    Member

    You need to add 100% height to the body and html.

    http://jsfiddle.net/Cxddw/1/

    #111903
    ashapanka
    Participant

    Thanks! 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?

    #111904
    Paulie_D
    Member

    It’s working in the Fiddle so something else must be going on.

    Without seeing a live site it’s difficult to comment.

    #111908
    ashapanka
    Participant

    I understand. I did some research and it looks like adding “clear: both; ” to the footer might fix my problem.

Viewing 15 posts - 1 through 15 (of 17 total)
  • The forum ‘CSS’ is closed to new topics and replies.