Deprecated: Function get_currentuserinfo is deprecated since version 4.5.0! Use wp_get_current_user() instead. in /var/www/html/wp-includes/functions.php on line 5383

Stopping footer "float"?

New Front EN Support Forums Kabuki Theme Support Stopping footer "float"?

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #11120

    On my front page (template = Page: background slider), the footer hangs out at the bottom of the page, and stays there when the browser window is resized.

    Is there any way to replicate that behavior on other page templates (in particular, Page: full-width and Page: right sidebar)? If the content area doesn’t have much content in it, the footer “rides up” and forms a stripe across the page, instead of tucking itself neatly at the bottom.

    Many thanks,

    ~IW

    #11121
    mmsatori
    Keymaster

    Hey Ian,

    you can use

    #footer {
    margin-top: 0px;
    position: fixed;
    bottom: 0px;
    }
    

    to force it to stick to the bottom on all pages, yet the catch here is that the “bottom” will be defined as the bottom of the browser window – i.e. if the page’s content exceeds the window height, the footer will overlap it. Without resorting to hacky solutions, it’s possible to either tell the footer to consider the bottom of the screen as its starting point, or the bottom of content, not both. This is why there’s no content block on the “Page with Background Slider” page template.

    Sincerely,
    Andrii / Satori Studio

    #11125

    Found this, which seems to be working nicely:

    html {
    position: relative;
    min-height: 100%;
    }
    body {
    margin: 0 0 100px; /* bottom = footer height */
    }
    footer {
    position: absolute;
    left: 0;
    bottom: 0;
    height: 35px;
    width: 100%;
    }

    #11129
    mmsatori
    Keymaster

    Thanks for sharing, Ian! Yes, this snippet should do the job; I’m calling the likes of it “hacky” because it assumes we know the footer height in advance, which is usually not the case when developing themes that will potentially be used by thousands of people – who might put different amounts of content into the footer (in addition to that, on smaller screens that content will pack into a larger number of lines and therefore further change its height quite unpredictably, complicating this even further). However, for a specific website, where you do know the desired height of the footer, that can indeed be a neat solution.

    Sincerely,
    Andrii / Satori Studio

    #11142

    Oh, I don’t think of “hacky” as a bad thing at all! I’m no expert – my version of hacky is “Let’s stick this code in there and see if it does something.” That snippet was the second thing I tried, so I’m happy with the outcome.

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.