css - 修复 IE7 div overflow-y : scroll from hiding contents behind the scrollbar

标签 css internet-explorer google-chrome vertical-scrolling

根据下面的 jsfildde,我在 div(#body) 中有一个表格,该表格沿 y 轴滚动。我的问题是,在 IE 中,滚动条隐藏了它后面最后一个表格单元格的一部分,随后移动了表格列的布局。 Chome中没有这个问题,我必须支持这两种浏览器。我认为问题出在 IE 上,而 Chrome 正在正确呈现 CSS。如何让 IE 以与 Chrome 相同的方式显示我的列?

如果在两个浏览器中查看 fiddle ,就会发现表头与相应列不对齐的区别。

http://jsfiddle.net/5DD5b/3/

感谢您提出的任何建议。

编辑:它适用于 IE9,但不适用于需要支持的 7。

最佳答案

由于这个问题似乎只出现在 IE7 中,我决定根据 ihake 的建议检测 userAgent 并进行相应处理。这并不理想,但它确实有效。

var IE7 = false;

$(document).ready(function(){

    if($.browser.msie) {
        var userAgent = $.browser.version;
        if(userAgent.substring(0,userAgent.indexOf('.')) == 7) IE7 = true;
    }

    ...

在文件的更下方,如果 IE7 为真,我将 css 设置为一种方式,如果 IE7 为假,则以另一种方式设置。很简单。

关于css - 修复 IE7 div overflow-y : scroll from hiding contents behind the scrollbar,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11784361/

相关文章:

CSS tabindex 单击隐藏主 div

xml - 为什么IE在查看XML文件时会提示安全警告?

javascript - 即 : how to trigger body's vertical scrollbar recalculation

javascript - 刷新 Chrome 时出现问题

javascript - if 语句主体高度 < 100% javascript/jquery

html - 浏览器实现.less文件

javascript - HTML + JS + CSS 转换器

javascript - 是否可以在 javascript 中测试 IE,而无需浏览器嗅探和条件注释?

javascript - 图表在 Firefox 或 Internet Explorer 中不起作用,仅在 Chrome 中起作用

javascript - xmlhttprequest 是否有任何最大/最小超时?