如何创建一个固定位置的div并与IE、FF和IE兼容铬合金
我已将(位置)固定在左侧。它有 style="overflow: auto" ,然后其余的文章转到可滚动的右侧。
sidenav 中的某些选项在 IE 和 FF 中不可见。据我所知,浏览器视图端口对于不同的浏览器是不同的。如何调整 sidenav 的高度以使所有选项都可见。
我很感激任何帮助。
谢谢。
I have fixed(position) on the left. It has style="overflow: auto" and then the rest of articles go to the right which is scrollable.
Some of options in the sidenav is not visible in IE and FF. I understand that Browser view port are different for different browsers. How can I adjust the height of sidenav so that all options are visible.
I appreciate any help.
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
添加overflow-y:auto到sidenav,这将使sidenav内容在视口高度小于sidenav内容高度时可滚动。
add
overflow-y:auto
to the sidenav, this will make the sidenav content scrollable when the height of the viewport is lesser than that of the content in sidenav.看看这是否有帮助:
http://jsbin.com/ixula4
我所做的是添加 <代码>顶部:0; height: 100% 到固定定位的 div 以及
overflow: auto
。似乎可以在 FF、Chrome 和 IE7(标准兼容模式)下工作。不确定其他浏览器是否如此。您最好研究一下“100% height divs”,以获取可以在其他浏览器中使用的技巧。See if this helps:
http://jsbin.com/ixula4
What I've done is that that I added
top: 0; height: 100%
to the fixed positioned div along withoverflow: auto
. Seems to work in FF, Chrome and IE7 (standards-compliance mode). Not sure about other browsers. You better research on "100% height divs" for hacks you can use in other browsers.您可以尝试使用溢出:可见而不是自动。
还修复了仅从 IE7+ 开始,旧版 IE 不支持的问题。
您有示例页面可供查看吗?
You could try to use overflow:visible instead of auto.
Also fixed is not supported on older IE only from IE7+.
Do you have an example page to look at?
这篇文章似乎对您非常有帮助,因为他们的演示似乎正是您想要做的。 http://cross-browser.com/x/examples/floater_fixed.html提供跨浏览器位置:固定的解决方案。
This article seems very helpful for you because their demo appears to be what you are trying to do. http://cross-browser.com/x/examples/floater_fixed.html Offers a cross-browser position:fixed solution.