虽然我网站上的大多数页面都有足够的内容来将页脚推到大多数人的页面底部。无论如何,无论屏幕尺寸如何,我都想知道它总是固定在底部。
我尝试过一些方法,如底部:0x;位置:绝对:从来没有似乎工作得很好,偶尔将页脚推出其容器,以使用其中的一些示例将其固定到底部。
包括页脚的两个部分的HTML和CSS(页脚和版权栏)。它们都位于< section id =“footer”>不管怎样
我删除了我试图让它粘贴,所以人们现在可以看看它,看看现在的代码是修改。
实时网址 – http://www.mangdevelopment.co.uk/nakedradish
(这是一个resturant网站,不用担心这个词’裸’)。
HTML
<section id="footer"> <div class="container"> <div class="row"> <div class="span1"> <div id="small-logo"> <img src="img/small-logo.png" /> </div> </div> <div class="span2"> <div class="footer-list"> <h6>OUR BoxES</h6> <ul> <a href="#"> <li>Classic Box</li> </a> <a href="#"> <li>Vegetarian Box</li> </a> <a href="#"> <li>Family Box</li> </a> <a href="#"> <li>Dinner Party Box</li> </a> <a href="#"> <li>Gift Box</li> </a> </ul> </div> </div> <div class="span2"> <div class="footer-list"> <h6>OUR RECIPES</h6> <ul> <a href="#"> <li>Last Weeks Feature</li> </a> <a href="#"> <li>Next Weeks Feature</li> </a> </ul> </div> </div> <div class="span2"> <div class="footer-list"> <h6>ABOUT US</h6> <ul> <a href="#"> <li>The Food</li> </a> <a href="#"> <li>How We Sourcex</li> </a> <a href="#"> <li>Sustainability</li> </a> <li><a href="about.html">About Us</a></li> <a href="#"> <li>Contact Us</li> </a> </ul> </div> </div> <div class="span5"> <div id="twitter"> <img src="img/twitter-logo.png" alt="" title="" height="50" width="50" class="twitter-logo" /> <div class="tweet-bg"> <div class="tweets"> <p>@chefallanp that's just not on really</p> </div> <div id="follow-btn"> <img src="img/follow-us.jpg" /> </div> </div> </div> <div class="checkout-options"> <h6>SECURE CHECKOUT</h6> <ul> <li><img src="img/solo-logo.png" /></li> <li><img src="img/switch-logo.png" /></li> <li><img src="img/maestro-logo.png" /></li> <li><img src="img/visa-logo.png" /></li> <a href="#"> <li><img src="img/facebook-logo.png" /></li> </a> <a href="#"> <li><img src="img/twitter-logo-flat.png" /></li> </a> </ul> </div> </div> </div> </div> <div id="copyright-bar"> <div class="container"> <div class="row"> <div class="copyright-content"> <div class="span4"> <p>The Naked Radish Limited. 2013 All rights reserved.</p> </div> <div class="span4 offset4"> <div class="copyright-list"> <ul> <a href="terms.html"> <li>Terms & Conditions</li> </a> <a href="privacy.html"> <li> - Privacy Policy</li> </a> <a href="#"> <li> - Cookie Policy</li> </a> </ul> </div> </div> </div> </div> </div> </section>
CSS:
#footer { background-color: #F3F3F3; padding-top: 10px; padding-bottom: 0px; }
解决方法
对于您的页脚:
#footer{ position:fixed; height:50px; background-color:red; bottom:0px; left:0px; right:0px; margin-bottom:0px; }
对于你的身体:
body{ margin-bottom:50px; }