【发布时间】:2012-09-14 05:19:38
【问题描述】:
我正在尝试创建一个位于论坛左侧并填充 100% 浏览器窗口高度的 div。当您滚动时,它也会保持在固定位置。
到目前为止,我的代码在 Chrome 和 FF 中运行良好;但是,在 IE 中,当您继续向下滚动页面时,滚动条会像页面在增长一样展开。
#sidebar {
background-color: #a75143;
width: 240px;
height: 100%;
position: fixed;
_position:absolute;
top: 0;
_top:expression(eval(document.body.scrollTop));
left: 0;
bottom: 0;
}
我知道是什么原因造成的——_top:expression(eval(document.body.scrollTop));——但这也是让 div 在 IE 中保持固定位置的原因。 p>
另外,overflow:hidden 没有任何作用。
如果您想了解我在说什么,请在 Internet Explorer 中打开 this page。
任何帮助将不胜感激。谢谢!
【问题讨论】:
-
你的 CSS 内嵌的 JavaScript 和以下划线开头的 CSS 是怎么回事?
-
annevankesteren.nl/test/examples/ie/position-fixed.html 在 Internet Explorer 中进行修复工作的唯一方法。
-
是的,真的不在乎它是否有效/黑客,我只想让它工作。
标签: html css scroll height fixed