首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 企业软件 > 行业软件 >

div 横向格局 中间高度自适应

2012-12-03 
div 横向布局 中间高度自适应htmldiv idheader styleheight:100px background-color:red/div

div 横向布局 中间高度自适应

<html>
<div id="header" style="height:100px; background-color:red"></div>
<div id="content" style="overflow-y:auto; background-color: yellow">会自动出现滚动条</div>
<div id="footer" style="height:100px; background-color:blue"></div>
<script type="text/javascript">
function resizeContent(){
??? availHeight = parseInt(document.body.clientHeight);
??? header_height=parseInt(document.getElementById("header").style.height);
??? footer_height=parseInt(document.getElementById("footer").style.height);
??? content_height=(availHeight-header_height-footer_height)+"px";
??? document.getElementById("content").style.height=content_height;
}
resizeContent();
window.onresize=resizeContent;
</script>
</html>

热点排行