表格单元格内的可滚动DIV
我知道,我的答案是经典的,但我找不到合适的解决方案,不是在这里,也不是谷歌。我正在尝试使用表格创建布局。我希望
table#layout
是100%的屏幕(不是更多)和#content-td
滚动。我的解决方案在FF / Chrome / Safari中运行良好,但在IE中有一些问题。如果#content-td
有height=100%
IE将设置高度等于桌面高度(这是错误的,因为我有#header
)。当我从#content-td
删除height=100%
时IE将崩溃此销售。有没有javascript的解决方案来修复div的高度?
<!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>
<style type="text/css">
html, body, #layout {height:100%; width:100%; margin:0; padding:0; overflow:hidden;}
#wrapper {overflow-y:scroll; position:relative; height:100%}
#content {position:absolute;}
/* highlight areas */
#header {background-color:#BADBAD;}
#sidebar {background-color:#DABDAB;}
#wrapper {background-color:#CD5C5C; font-size:40px;}
</style>
</head>
<body>
<table id="layout" border="1" cellpadding="0" cellspacing="0">
<tr height="1%">
<td colspan="2" id="header">Header</td>
</tr>
<tr valign="top" height="100%">
<td id="content-td" width="70%" height="100%">
<div id="wrapper">
<div id="content">
Here is long text I want to scroll down<br/>
Here is long text I want to scroll down<br/>
Here is long text I want to scroll down<br/>
</div>
</div>
</td>
<td id="sidebar" width="30%">Sidebar</td>
</tr>
</table>
</body>
</html>
没有doctype它工作正常,但我想要一个有效的文档。这是测试页面。
没有找到相关结果
已邀请:
1 个回复
降女陷费券
来保持导航在视图中。例如,你可以制作一个主内容框和一个导航框,并使用这样的东西(在Firefox中测试):
如果这不是您想要的,那么提供一些示例站点或图表的链接。