您好,登录后才能下订单哦!
这篇文章主要介绍“如何编写网页上中下三分布局即上下固定中间自适应的代码”,在日常操作中,相信很多人在如何编写网页上中下三分布局即上下固定中间自适应的代码问题上存在疑惑,小编查阅了各式资料,整理出简单好用的操作方法,希望对大家解答”如何编写网页上中下三分布局即上下固定中间自适应的代码”的疑惑有所帮助!接下来,请跟着小编一起来学习吧!
															
代码如下:
<!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> 
到此,关于“如何编写网页上中下三分布局即上下固定中间自适应的代码”的学习就结束了,希望能够解决大家的疑惑。理论与实践的搭配能更好的帮助大家学习,快去试试吧!若想继续学习更多相关知识,请继续关注亿速云网站,小编会继续努力为大家带来更多实用的文章!
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。