试图为此找到解决方案,但无法真正想出任何办法。这是我想做的基础知识。
想让我的布局在 3 个 div 中,第 1 部分是标题(徽标),第 2 部分是水平菜单,第 3 部分是根据您的菜单选择更改的菜单特定内容。我希望没有浏览器滚动条,并且始终显示第 1 节和第 2 节,第 3 节延伸到浏览器窗口的底部,并且始终可见 scollbar。我会把我的代码放在最后,但它在 FF 中运行良好,但在 IE8 中运行良好。我读过你不能在同一个 div 中使用 top 和 bottom,但为什么不呢?它在 FF 中按预期工作就好了。我尝试设置顶部并使用高度 100%,但由于我将顶部设置为 163,它会将底部置于窗口下方 163 像素处。我希望第 3 部分随着窗口垂直扩展或收缩而增长和收缩。这是我大大简化的代码。我' 我们使用内联样式来最大程度地减少对多个文件的处理并在测试时轻松。index.css 在这种情况下是无关紧要的。
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
<title>Test Junk</title>
<link rel="stylesheet" type="text/css" href="index.css">
</head>
<body>
<div style="background-color:#cccea2; text-align:center;height:136">
section 1
</div>
<div style="background-color:#ccace2; text-align:center;height:27">
section 2
</div>
<div style="background-color:#225522; text-align:center;position:absolute;top:163;bottom:0;width:100%;overflow-y:scroll;overflow-x:hidden;">
section 3
</div>
</body>
</html>
更新:我使用 xhtml doctype 取得了一些成功,正在寻找一个好的解决方案。但我在另一个例子中发现了这一点,同时继续我长期寻找解决方案。我仍然真的不明白为什么你不应该在同一个 div 上使用 TOP 和 BOTTOM,它们是两个非常不同的东西。