I have a website with two footers. One behaves very well as a “fixed” footer that always appears at the bottom of the page. The other footer is larger and should be below the entire content, only appearing when scrolling all the content (if the content is larger than on the page, it should not be visible until you go to the bottom). However, it should be sticky so that if there was very little content, it would not move and leave an uncomfortable white gap.
Now it is displayed in the middle of the page. :( Help?
html, body { height: 100%; width: 100%; } #PageContainer { width: 100%; height: 100%; } header { width: 100%; } #Content { position: relative; background-image:url(Images/Golf%20Ball%20Texture.jpg); background-repeat:repeat; background-size: 150px auto; width: 100%; padding-left: 20px; margin-left: -20px; padding-right: 20px; margin-right: -20px; min-height: 90%; } footer { width: 100%; } #MovingFooter { clear: both; position: absolute; width: 100%; background-color: #FFD600; right: 0; bottom: 0; font-size: .9em; } #StickyFooter { position: fixed; bottom: 0; width: 100%; height: 50px; background-color: #787878; padding-left: 20px; margin-left: -20px; padding-right: 20px; margin-right: -20px; }
<!doctype html> <html> <head> <meta charset="UTF-8"> <link rel="Stylesheet" href="../style.css" type="text/css" /> <link rel="shortcut icon" href="Images/Logo%20Favicon.ico"> <title>Your Personality</title> </head> <div id="PageContainer"> <header> </header> <body> <div id="Content"> </div> <div id="MovingFooter"> <h2>Company Philosophy</h2> <p>Footer content</p> </div> </div> </div> <div id="StickyFooter"> <p class="FancyFinePrint">© Copyright 2014 by <a href="http://www.geneticgolf.com">Company Name</a>. All Rights Reserved.</p> <div id="FooterPartners"> <p class="FooterPartnerText">Proud Partners With:</p> </div> </div> </div> </body>
source share