[英]How to use overflow:auto with a non-px height in IE7
I am trying to get the following code to work without the 670px hardcoded into the app: 我试图使以下代码在没有将670px硬编码到应用程序的情况下工作:
<tr>
<td height="100%">
<div id="navigation" class="navigation">
<jsp:include page="menu.jsp" flush="true"/>
</div>
</td>
<td>
<div style="height:670px; overflow: auto; width:100%;">
<jsp:include page='dynamicContent.jsp' flush="true"/>
</div>
<div>
<center><jsp:include page="footer.jsp" flush="true" /></center>
</div>
</td>
</tr>
It renders fine in IE7 before a window resize - the content pane scrolls with the footer at a fixed height above the page bottom. 在调整窗口大小之前,它在IE7中可以正常显示-内容窗格以页脚在页面底部上方的固定高度滚动。
However, this stops working (for obvious reasons) when I make the window smaller as I have the HTML of the page set to use overflow:hidden. 但是,当我缩小窗口时,由于我将页面的HTML设置为使用overflow:hidden,因此这会停止工作(出于明显的原因)。
Unfortunately, using "height:75%" doesn't seem to be compatible with overflow in IE7. 不幸的是,使用“ height:75%”似乎与IE7中的溢出不兼容。
Does anyone have any idea how I might fake this for IE7 (it needs to be compatible with IE7 cause of project requirements)? 有谁知道我该如何伪造IE7(它必须与IE7兼容才能满足项目要求)? Unfortunately this code is pretty embedded so using CSS positioning instead of a table is also probably more work than we will be able to handle before our next release.
不幸的是,这段代码是非常嵌入的,因此使用CSS定位而不是表格可能比我们在下一个版本发布之前要处理的工作还要多。
Get rid of the overlow: auto
, the overlow: hidden
, and the fixed height. 摆脱
overlow: auto
, overlow: hidden
和固定高度的问题。 Instead give your footer a fixed position and add a bottom margin to the body the height of the footer. 而是将页脚固定在一个位置,并在页脚的底部增加页脚的高度。
body
{
margin-bottom: 100px;
}
.footer
{
position: fixed;
bottom: 0;
height: 90px;
padding-top: 10px;
background-color: #fff;
}
Make sure to set a background for the footer, or else the page content can show through. 确保为页脚设置背景,否则页面内容可以显示出来。
Here's a working live example: http://jsfiddle.net/ADpMs/ 这是一个工作示例: http : //jsfiddle.net/ADpMs/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.