【发布时间】:2016-06-21 12:23:16
【问题描述】:
我试图让页脚留在页面底部,即使内容太短。我不想要一个固定的页脚。我想要一个粘性页脚。
我有一个部分导致了这些问题。我只希望该部分填充页脚的空间,除非有必要,否则没有滚动条。
http://fabricatorsunlimited.com/test/quartzcare.html
这是我正在处理的页面,因为没有内容。是否可以看到,你必须滚动才能查看滚动条,即使没有内容。
HTML
<head>
</HEAD>
<body class="size-960">
<section>
<!-- HEADER -->
<header>
</header>
<!-- HOME PAGE BLOCK -->
<div class="line">
<div class="margin"></div></div>
<!-- ASIDE NAV AND CONTENT -->
<div class="line">
<div class="box margin-bottom">
<div class="margin">
<!-- CONTENT -->
<article class="s-12 l-8">
<h1>Quartz Care</h1>
<p>....</p>
</div></article></div></div>
</section>
<!-- FOOTER -->
<footer>
</footer>
</body>
</html>
CSS
* {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
margin: 0;}
html {height: 100%;
box-sizing: border-box;}
*,*:before,*:after {box-sizing: inherit;}
body {
font-family: "Open Sans";
color: #413D3D;
background: url("bodyback.png");
position: relative;
min-height: 100%;}
.box {
background: #ffffff;
padding: 1.25em;
margin-top: 20px;
border-top: 1px #0068B3 solid;
background-color:#ffffff;
min-height: 100%;}
section {
min-height: 100%;
padding-bottom: -85px;}
footer {
background: #959595;
position: absolute;
right: 0;
bottom: 0;
left: 0;
color: #ffffff;
height: 85px;}
【问题讨论】:
-
你不是在打开 3 个 div,在 '' 之后没有关闭吗?