将页脚固定到页面底部 [英] Fix footer to bottom of page
问题描述
虽然我的网站上的大多数网页都有足够的内容将页脚推到大多数人的网页底部。
Although most pages on my site have enough content to push the footer to the bottom of the page for most people. I would like to know it's always fixed to the bottom regardless of screen size from now on anyway.
我尝试了很多方法,例如bottom: 0x;
position:absolute:
等。似乎从来没有工作得很好,偶尔将页脚推出容器,
I've tried a number of ways such as bottom: 0x;
position:absolute:
etc. Never seems to work very well, occasionally pushes the footer out of its container to fix to the bottom using some of those examples right there.
包括页脚两个部分(页脚和版权栏)的HTML和CSS。他们都在< section id =footer>
div
。
Included is the HTML and CSS for the two parts of the footer (footer & copyright bar). They're both inside of a <section id="footer">
div
anyway.
我取消了试图让它粘贴,所以人们可以看看它现在看看当前的代码是什么修改。
I removed my attempts at getting it to stick so people can have a look at it right now and see what the current code is to amend.
实际网址 - http://www.mangdevelopment.co.uk/nakedradish
(这是一个resturant网站,不要担心'naked'一词。)
(It's a resturant website. Don't worry about the word 'naked').
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;
}
推荐答案
c> footer :
For your footer
:
#footer{
position:fixed;
height:50px;
background-color:red;
bottom:0px;
left:0px;
right:0px;
margin-bottom:0px;
}
:
body{
margin-bottom:50px;
}
这篇关于将页脚固定到页面底部的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!