复制代码
代码如下:
<!DOCTY PE ht ML P ub LIC "-//W3C//DTD XHTML 1.0 Trans IT ional//EN" "http://www.w3. org /TR/xhtml1/DTD/xhtml1 -t ransitional.dtd">
<html XM lns="http://www.w3.org/1999/xhtml">
<head>
<!-- 禁止浏览器从本地缓存中调阅页面。-->
< ;m eta http-equiv=" PR agr am " content="no-cache">
<!--网页不保存在缓存中,每次访问都刷新页面。-->
<meta http-equiv="cache-control" content="no-cache, must- rev alidate">
<!--同上面 意思 差不多,必须重新加载页面-->
<!--网页在缓存中的过期时间为0,一旦网页过期,必须从 服务器 上重新订阅-->
<meta http-equiv="e xp ires" content="0">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<style type="text/css">
* {
m arg in:0;
padding:0;
}
html,
body,
# box {
h ei ght:100%;
font:small/1.5 " 宋体 ", serif;
}
body {
text-align: center ;
}
#box {
text-align:left;
background:#666;
dis play :table;
width:80%;
mar gin :0 auto;
position:relative;
}
#box > div {
display:table-row;
}
#header,
#footer {
background:# fc c;
height:50px;
vert ical -align:bottom;
}
#m ai n {
background:#c CF ;
}
#main #wrap {
display:table-cell;
background:#ffc;
vertical-align:middle;
}
#text {
text-align:center;
}
</style>
<!--[if IE]>
<style type="text/css">
#header,
#footer {
width:100%;
z -i ndex:3;
position:absolute;
}
#footer {
bottom:0;
}
#main {
height:100%;
z-index:1;
position:relative;
}
#main #wrap {
position:absolute;
top:50%;
width:100%;
text-align:left;
}
#main #text {
position:relative;
width:100%;
top:-50%;
background:#ccc;
}
</style>
<![endif]-->
</head>
<body>
<div id="box">
<div id="header">header</div>
<div id="main">
<div id="wrap">
<div id="text">
<p>测试文本</p>
</div>
</div>
</div>
<div id="footer">footer</div>
</div>
</body>
</html>
总结
以上是 为你收集整理的 网页上中下三分布局即上下固定中间自适应 全部内容,希望文章能够帮你解决 网页上中下三分布局即上下固定中间自适应 所遇到的问题。
如果觉得 网站内容还不错, 推荐好友。
查看更多关于网页上中下三分布局即上下固定中间自适应的详细内容...