网页上中下三分布局,上下固定,中间自适应

<!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"> 
<head> 
<!-- 禁止浏览器从本地缓存中调阅页面。-->
    <meta http-equiv="pragram" content="no-cache">
    <!--网页不保存在缓存中,每次访问都刷新页面。-->
    <meta http-equiv="cache-control" content="no-cache, must-revalidate">
    <!--同上面意思差不多,必须重新加载页面-->
    <!--网页在缓存中的过期时间为0,一旦网页过期,必须从服务器上重新订阅-->
    <meta http-equiv="expires" content="0">

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title> 
<style type="text/css"> 
* { 
	margin:0; 
	padding:0; 
} 
html, 
body, 
#box { 
height:100%; 
	font:small/1.5 "宋体", serif; 
} 
body { 
	text-align:center; 
} 
#box { 
	text-align:left; 
	background:#666; 
	display:table; 
	width:80%; 
	margin:0 auto; 
	position:relative; 
} 
#box > div { 
	display:table-row; 
} 
#header, 
#footer { 
	background:#fcc; 
	height:50px; 
	vertical-align:bottom; 
} 
#main { 
	background:#ccf; 
} 
#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-index: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> 

  • 5
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Yours风之恋

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值