HTML table not rendering correctly in IE9

醉酒当歌 提交于 2019-12-05 07:09:28

This seems to be a known bug with IE9 on rendering large tables. The problem was resolved when removing white space between table def opening and closing tags eg. </td><td>

MSDN discussion on IE 9 rendering

This is a known IE9 issue, you can fix this by putting the following code somewhere in your HTML page:

$(function() {
    var browser = $.browser;
    if ( browser.msie && browser.version.slice(0,3) == "9.0" ) {
        $('table').each(function(index) {
                var replace = $(this).html().replace(/td>\s+<td/g,'td><td'); 
                $(this).html(replace);
        });
    }
});
Petamannen

I had a huge table that expanded when a Click event occurred. Happened only in IE9, all was fine in IE8, IE10, Chrome etc.

The above solution failed for me, as well as others answers of the same kind.

I solved it this way:

I added borders to the table and it was clear that the HTML was not correct. Either some colspan was missing or the cells needed &nbsp; or could have been anything.

I also noticed that now, with the tables border=1 attribute, the problem with the Click-expanding was gone.

So I put a class xltable to the table and put .xltable td {border:0px solid white;} in my css.

My code is still not "valid" but it works.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!