【发布时间】:2014-05-22 13:22:59
【问题描述】:
我不擅长网页设计,我正在做一个由Adobe Dreamweaver自动生成的网页模板。
即使页面上没有内容,我也想将footer的DIV推到页面底部。
这是.CSS(我省略了一些)
body {
font: 100%/1.4 Verdana, Arial, Helvetica, sans-serif;
background: #42413C;
margin: 0;
padding: 0;
color: #000;
}
.container {
width: 960px;
background: #FFF;
margin: 0 auto;
}
.header {
background: #ADB96E;
}
.sidebar1 {
float: left;
width: 180px;
background: #EADCAE;
padding-bottom: 10px;
}
.content {
padding: 10px 0;
width: 780px;
float: left;
}
/* ~~ The footer ~~ */
.footer {
padding: 10px 0;
background: #CCC49F;
position: relative;/* this gives IE6 hasLayout to properly clear */
clear: both; /* this clear property forces the .container to understand where the
}
这是我页面的常见标记。
<body>
<div class="container">
<?php
include('templates/header.php');
include_once('templates/sidebar.php');
?>
<div class="content">
<!-- end .content --></div>
<div class="footer">
<p>This is a simple footer.</p>
<!-- end .footer --></div>
<!-- end .container --></div>
</body>
页面上的页脚看起来像
我已经为 footer 尝试过这个。
position: fixed;
bottom: 0;
width: 100%;
但是页面看起来像
【问题讨论】:
-
@Lorenzo 你偷了我的话!那些不知道答案的人,他们投反对票。
-
并非所有 SO 用户都很聪明
-
@Lorenzo 聪明到可以按下 DownVote