Sticky Footer for Magento: the Cut & Paste solution (CSS only!)

When designing a webshop, you will always have pages that contain lot less content then other pages. In Magento for example, you'll have pages like customer login, contact, forgot password, search terms, 404 (noRoute) etc, which just don't fill your page enough. As a result these pages end up with a strange looking page with a footer filling 40% (or more, depends on the resolution of your workspace) of the physical space. This doesn't make sense - the footer isnt thát important - and personally, I think it looks bad.

So, If you may well know a nice way around this is to create a sticky footer. In other words, make your footer always stick to the bottom of page and only make your page scrollable when needed. The situation however, is that most solutions you'll find are pretty hard to implement. You'll have to add new HTML elements, rearrange your Markup, do a lot of testing etc. Well, I'm going to put an end to all that. Magento has really rich templates by default, so I've found a way to create sticky footers with just a few lines of CSS. No extra HTML markup, no editing templates!

The Cut & Paste solution.

Paste the following on the bottom of your styles.css file. As you can see, you'll only have to change '300px' to the desired hight or your footer (the main-container bottom-padding as the footer-container height). That's it!  Tested in internet explorer 6, IE7, IE8, Chrome, Firefox, Safari and Opera.

Let me know if everything works out for you too!

H&O is expert in het oplossen van complexe Magento vraagstukken, maatwerk grafisch ontwerp en het bouwen van custom Magento modules.

Als je op zoek bent naar een partner die je kan helpen met het beantwoorden van moeilijke Magento vragen, een maatwerk productimport voor je ontwikkeld of een custom Magento module voor je schrijft die jouw assortiment met een andere webshop koppelt, dan ben je aan het juiste adres. H&O heeft zich sinds 2007 verdiept in de techniek en ontwikkelingen van het e-commerce CMS, speelt een actieve rol in de community, heeft verschillende modules uitgebracht en heeft voor klanten uiteenlopende technische modules ontwikkeld. Ons kantoor is gevestigd in Roelofarendsveen, direct naast de A4 én slechts op 15 minuten afstand van Amsterdam. Neem contact met ons op en kom eens langs, dan bespreken we jouw vraagstuk!

Erwin Otten

Erwin Otten is a Web Designer / Graphic Designer from Oude Wetering (The Netherlands) and co-founder of Hachmang & Otten. With an education in communication & multimedia design, he is passionate about web design at all levels including (information) architecture, interaction, code, and graphic design. Contact Erwin Otten

Comments
  • David Aschen

    (mar 25)
    Reply to this comment

    Works great, thank you

  • Patrick

    (mei 28)
    Reply to this comment

    When i implement this on my shop, it places the menu (electronics, furniture, appearal) to the bottom.

  • Bill

    (aug 31)
    Reply to this comment

    Thanks for sharing this. Worked great. Amazed I didn’t need to adjust the layout at all.

  • Daniel

    (sep 06)
    Reply to this comment

    This worked like a charm with a slight modification to fit my footer. THANK YOU!

  • Magento Designer

    (sep 16)
    Reply to this comment

    This is an excellent post. I really appreciate with you. I enjoyed the post. Thanks for sharing.

  • Rowan

    (okt 30)
    Reply to this comment

    Hi
    Thank you so much! Very nice and easy to implement.
    Only 1 thing, the location of my footer is different on some pages, any idea?

    Bedankt!

    Rowan

  • Arne Gartz

    (jan 31)
    Reply to this comment

    Thanks man, this helped me out!

  • Muhammad Azam

    (feb 25)
    Reply to this comment

    Realy very helpful post

  • Nic

    (mei 22)
    Reply to this comment

    That helps a lot!  Really appreciate it!

  • Arek

    (jul 02)
    Reply to this comment

    Great post, Could you give me please suggestion what shell I change in the code to make it work
    for Classic themes. I would be very grateful I have been trying to solve this problem for the past a few days.

  • Jon Dalton

    (okt 02)
    Reply to this comment

    Thanks for sharing this.
    One slight problem is that the CSS statement :
    body { height:100% }
    stops the magento “remember-me-tooltip” (template/persistent/remember_me_tooltip.phtml) from displaying correctly.
    For anyone not familar with this, in Magento (1.6?) and 1.7 CE there is the ‘persistent cookie’ function that can be turned on in the backend. When turned on, in a page such as ‘Checkout > Billing Information’ there is a checkbox to allow the customer to turn persistent cookies on or off. Next to the checkbox is a link named “What’s this?” - when clicked a “popup” message box will appear.
    The popup message box uses a dimmed bgackground over the viewport in the same way that product image “lightbox” extension for Magento uses. But with Sticky Footer being used, the dimmed background (called Window Overlay) does not extend all the way down the page to the footer *
    * Note the billing information page being viewed was greater length than the viewport.
    It seems that the amount of dimmed overlay being clipped is equal to the amount of page height that exceeds the viewport height.
    Any thoughts on this much appreciated.

  • aj

    (feb 05)
    Reply to this comment

    It doens’t work for me. Maybe I am doing something wrong. I have tried to change the high, but nothing happend. Is there maybe another solution?

Reageren

Contact

Bel mij terug

Vul uw telefoonnummer in en we bellen u zo spoedig mogelijk terug.

Contactgegevens

H&O
Veenderveld 20
2371 TV
Roelofarendsveen
info@h-o.nl
www.h-o.nl
071 744 0084
KvK Rijnland nr. 28119089
BTW nr. NL818554071B01

Nieuwe projecten

Wilt u weten wat H&O kan betekenen voor uw Magento project? Stuur ons een mailtje:

Paul Hachmang

p.hachmang@h-o.nl

Erwin Otten

e.otten@h-o.nl

Contactformulier