我的CSS文件相关内容如下:
#centercol
{
position: relative inherit; margin-left: 200px; padding: 0px; background-color: white;height: 500px;
}
#footer
{
position: relative inherit; padding: 0px; margin: 0px; width: 100%; height: 62px;
background-image: url(images/FooterSlice.gif);
}
现在footer是随着Center的变高而往下移的,但Center中的内容高小于500px时,footer仍然要跟上去,如何控制footer在500px以下的位置显示?
#centercol
{
position: relative inherit; margin-left: 200px; padding: 0px; background-color: white;height: 500px;
}
#footer
{
position: relative inherit; padding: 0px; margin: 0px; width: 100%; height: 62px;
background-image: url(images/FooterSlice.gif);
}
现在footer是随着Center的变高而往下移的,但Center中的内容高小于500px时,footer仍然要跟上去,如何控制footer在500px以下的位置显示?
解决方案 »
- 求助关于网站目录问题【100分】
- winform中DataGridView赋值的一个问题(高手帮忙)
- SaveFileDialog问题(实力体现)
- 怎样给datalist或gridview动态添加列?
- 100分求TREEVIEW控件的节点加边框、节点改变背景颜色、节点文字前..
- 如何做才能使datagrid有滚动条?
- 请问dataset可以用数组来填充,生成一个table呢?
- 如何在asp.net中实现Applet的功能
- 谁能解决这个问题,俺的100分全给了!
- google map api 被屏蔽,世界地图业务如何解决?
- |M|最近在学习一个DIV+CSS排列的 但这个Table要怎么拼成DIV+CSS呢 第二贴: jinjazz 的写法没有办法让他们的列对齐 谢谢
- 求助高手c#.net方面的问题
加上height: 500px;时,Center内容超过500px时,footer不会上移,会盖在加长了的Center内容上面。
#musthight
{
position:absolute;margin-left: 200px; padding: 0px; top: 184px;
}
在这个div中,放一个500px高,1px宽,透明的panel控件。页面中还必须有下面的脚本
<script type="text/javascript">
function AdjustColumnsHeight()
{
// get a reference to the three DIVS that make up the columns
var centerCol = window.document.getElementById('centercol');
var leftCol = window.document.getElementById('leftcol');
var rightCol = window.document.getElementById('rightcol');
var musthight=window.document.getElementById("musthight");
// calculate the max height
var hCenterCol = centerCol.offsetHeight;
var hLeftCol = leftCol.offsetHeight;
var hRightCol = rightCol.offsetHeight;
var hmusthight=musthight.offsetHeight;
var maxHeight = Math.max(hmusthight,Math.max(hCenterCol, Math.max(hLeftCol, hRightCol)));
// set the height of all 3 DIVS to the max height
centerCol.style.height = maxHeight + 'px';
leftCol.style.height = maxHeight + 'px';
rightCol.style.height = maxHeight + 'px';
hmusthight.style.height=maxHeitht+'px';
// Show the footer
window.document.getElementById('footer').style.visibility = 'inherit';
}
window.onload = function() { AdjustColumnsHeight(); }
</script>