Sticky Footers in SharePoint 12

I get this question a lot these days: “How can I add a sticky footer to the bottom of SharePoint”. So much so that I decided I need to have a blog post that points to my solution to the problem.

First, what it a sticky footer? I consider this to be a footer at the bottom of a page that stays “stuck” to the bottom of the browser window ONLY if the page content does not fill up the full page. If you want a footer that sticks to the bottom without considering the page content, you can easily float one above the content always stuck to the bottom with just absolute CSS positioning.

How do I solve it. There are many ways this problem could be solved ranging from intelligent HTML and CSS creation to jQuery based solutions. I am leaning towards a jQuery based solution because often with SharePoint you don’t have a ton of control over most of the HTML markup. In my solution, all you need is a

with an id of customFooter, like this:

<div id="customFooter"></div>

at the bottom of your master page (you probably want to add some height and some other styling to this div as well). Then you need a reference to jQuery and then the JavaScript that I include below that will measure the page content height and add it to the ribbon height and determine if those two together are smaller than the browser window. If they are smaller, the jQuery will add some top-margin to the footer, just enough to push it to the bottom of the window. I won’t go into how you should add jQuery to SharePoint but here is a link that can help you determine the best method:

I have two scripts, one for SharePoint 2010 and one for SharePoint 2013. The differences are:

  • SP2010 – I use jQuery.noConflict(); and jQuery instead of $ throughout because some things in SP2010 conflict with the use of the dollar sign.
  • SP2013 – I use the typical jQuery $ reference and the way the ribbon height is measured is a bit more complicated since there are a couple different ways you can load the ribbon depending on if you use Seattle.master or the Design Manager

Download the jQuery code from here: Please consider this code to by experimental, I haven’t thoroughly tested it at this point. Use my contact link at the top or hit me up on Twitter if you run into issues with it.

Here is a screenshot of how I pull in the stickyfooter scripts. I place it at the bottom of my page under the customFooter.


And here is a screenshot of my (rather boring) footer sticking to the bottom of the browser:


12 thoughts on “Sticky Footers in SharePoint

  1. Reply bniaulin Jan 23,2013 10:41 am

    Very nice article, I have done it in 2013 using CSS for those that want to use that approach. Though the article talks about something else, there is a section on creating the sticky footer. The downside is that it will go over content.

  2. Reply SharePoint Innovations Jan 30,2013 6:52 pm

    Thanks for sharing! Great post

  3. Reply Rodrigo Ogiwara Apr 3,2014 7:54 am

    Thanks for the code, great post! Just a thing, when you click to add a new document for example, the page loads an iframe for upload the documents and the footer also appears there. I added this in your script to check if the page is loading from an iframe the footer will not show.

    var isInIframe = (window.location != window.parent.location) ? true : false;
    if (isInIframe == false)
       //show footer after calculating

  4. Reply marc May 6,2014 1:24 pm

    I added a tabbed webpart from ( to my 2013 environment. Now if the content of those tabs is different heights, the footer does not adjust to the new page height. Is there an event that could be detected to call the “calcFooter”

  5. Reply Diego Jul 8,2014 1:24 pm

    Will this solution work for responsive footers (in which content within the footer wraps as browser width is reduced, causing height of footer to increase)?

  6. Reply Dan Sep 25,2014 2:14 am

    In order to get this to work in SharePoint Online you need to take into account the O365 bar at the top. I added this to the code:

    var o365NavbarHeight = $("#O365_NavHeader").height();
    if (o365NavbarHeight == null) o365NavbarHeight = 0;

    and then changed

    var difference = windowheight - (bodyheight + ribbonheight + footerheight + o365NavbarHeight);


    var difference = windowheight - (bodyheight + ribbonheight + footerheight);

  7. Reply Dan Sep 25,2014 2:17 am

    Edit: in my above comment, the last two code snippets are in the wrong order.

  8. Reply Aaron Hamilton Mar 6,2015 3:53 pm

    This is great stuff Randy! A few things changes I made:

    1. Added JS script in scriptlink control (for consistency… not sure if it ultimately matters)

    <SharePoint:Scriptlink Language="javascript" runat="server" Name="~sitecollection/_catalogs/masterpage/OCT/js/stickyfooter.js" LoadAfterUI="true" OnDemand="false" Localizable="false" />

    2. Added display:none to the customFooter tag. This fixed a problem where my footer was “bouncing” from its default position mid-page down the the bottom every time a short page loaded.

  9. Reply Aaron Hamilton Mar 6,2015 3:57 pm

    Rodrigo, your code to check for iFrame works like a charm!

  10. Reply Graham Mar 29,2016 12:53 pm


    what is this line (25) intended to do?
    ribbonheight == null && (ribbonheight = 0);

    It looks like you are trying to check if the ribbon height exists and if it doesn’t to assign it a value of 0. I don’t understand why you use the && operator though.


  11. Reply Sumit May 10,2016 9:58 pm


    Footer works in my case, but appear over above the webparts.
    In short the footer footer is not at the bottom of the page, but bottom of the windows screen.
    Therefore the moment you scroll, it will move along and eventually will block the view of the content on the page.

    Please suggest what best can be done.

  12. Reply Gina Jun 15,2016 9:51 am

    Good read. Thanks for sharing.

Leave a Reply