我正在尝试做这样的页面 - http://www.wickham43.supanet.com/tutorial/headerfooterfixexample.html 但我希望只留下来。 所以我创建了这个,但这不起作用。你能告诉我为什么吗?
<html>
<head>
<title></title>
<meta http-equiv="Content-Language" content="en" />
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<style type="text/css" media="screen,print">
body,
html{
margin:0;
padding:0;
}
div#middlewrap {
margin-left:16px;
padding-bottom:50px;
}
/* no positioning for IE5/Win - the whole page scrolls */
div#footerwrap {
width:100%;
position:absolute;
bottom:0;
left:0;
height:50px;
}
body>div#footerwrap {
position:fixed;
}
div#footer {
height:50px;
width:1520px;
margin:0 auto;
}
/* Styling rules to make this demo page look nice. */
body,
html{
font-family:"Trebuchet MS", Georgia, Verdana, serif;
color:#335500;
background:#e9e9e2;
}
div#header,
div#footer {
background:#de7008;
color:#eee;
}
div #footer p {
margin:0;
padding:0;
text-align:center;
}
div#footer a {
color:#fff;
}
p {
margin-bottom:0;
font-size:0.8em;
line-height:1.4em;
}
pre {
font-size:0.9em;
line-height:1.4em;
}
</style>
</head>
<body>
<div id="middlewrap">
gfhgfhgfh
<br /><br /><br /><br /><br /><br /><br /><br /><br />
<br /><br /><br /><br /><br /><br /><br /><br /><br />
gfdgfdgdf gfdgfdgdf gfdgfdgdf gfdgfdgdf gfdgfdgdf gfdgfdgdf gfdgfdgdf gfdgfdgdf gfdgfdgdf gfdgfdgdf <br /><br /><br /><br /><br /><br /><br /><br /><br />
<br /><br /><br /><br /><br /><br /><br /><br /><br />
<br /><br /><br /><br /><br /><br /><br /><br /><br />
<br /><br /><br /><br /><br /><br /><br /><br /><br />
<br /><br /><br /><br /><br /><br /><br /><br /><br />
</div>
<div id="footerwrap">
<div id="footer"></div>
</div>
</body>
</html>
答案 0 :(得分:0)
你走了。
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en"> <!-- make it play nice in IE -->
<head>
<title></title>
<meta http-equiv="Content-Language" content="en" />
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<style type="text/css" media="screen,print">
body,
html{
margin:0;
position: relative;
padding:0;
}
div#middlewrap {
margin-left:16px;
padding-bottom:50px;
}
/* no positioning for IE5/Win - the whole page scrolls */
div#footerwrap {
width:100%;
position:absolute;
bottom:0px;
left:0px;
height:50px;
}
body>div#footerwrap {
position:fixed;
bottom: 0px;
}
div#footer {
height:50px;
width:1520px;
margin:0 auto;
}
/* Styling rules to make this demo page look nice. */
body,
html{
font-family:"Trebuchet MS", Georgia, Verdana, serif;
color:#335500;
background:#e9e9e2;
}
div#header,
div#footer {
background:#de7008;
color:#eee;
}
div #footer p {
margin:0;
padding:0;
text-align:center;
}
div#footer a {
color:#fff;
}
p {
margin-bottom:0;
font-size:0.8em;
line-height:1.4em;
}
pre {
font-size:0.9em;
line-height:1.4em;
}
</style>
</head>
<body>
<div id="middlewrap">
gfhgfhgfh
<br /><br /><br /><br /><br /><br /><br /><br /><br />
<br /><br /><br /><br /><br /><br /><br /><br /><br />
gfdgfdgdf gfdgfdgdf gfdgfdgdf gfdgfdgdf gfdgfdgdf gfdgfdgdf gfdgfdgdf gfdgfdgdf gfdgfdgdf gfdgfdgdf <br /><br /><br /><br /><br /><br /><br /><br /><br />
<br /><br /><br /><br /><br /><br /><br /><br /><br />
<br /><br /><br /><br /><br /><br /><br /><br /><br />
<br /><br /><br /><br /><br /><br /><br /><br /><br />
<br /><br /><br /><br /><br /><br /><br /><br /><br />
</div>
<div id="footerwrap">
<div id="footer"></div>
</div>
</body>
</html>