IE9表格布局明显受HTML元素之间的空白影响 [英] IE9 table layout apparently affected by whitespace between HTML elements

查看:106
本文介绍了IE9表格布局明显受HTML元素之间的空白影响的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我很感激帮助调试网页。该页面在FF4和Chrome10中显示OK,但在IE9中不显示。奇怪的是,表的布局似乎取决于< / td>之间的空白行数。和< td>。从理论上讲,块元素之间的空格是多少是多少,对吧?但是当删除空行时,表格显示会发生变化。

I'd appreciate help debugging a web page. The page displays OK in FF4 and Chrome10, but not in IE9. Strangely, the layout of a table seems to depend on the number of whitespace lines between </td> and <td>. In theory, it ought not matter how much whitespace is between block elements, right? But the table display changes when blank lines are removed.

当文件的其他方面也发生变化时,显示会发生变化。我怀疑格式错误的HTML(这是一个旧的和奇怪的页面),但它通过我尝试过的所有验证器(它在FF / Chrome和IE的上一版本中正确显示)。在任何情况下,为什么在块之间删除
空行会影响事情呢?

The display changes when other aspects of the file change too. I suspect malformed HTML (it's an old and odd page), but it passes all validators I've tried (and it displays correctly in FF/Chrome and prev versions of IE). In any case, why would removing blank lines between blocks affect things?

就好像IE9的内部数据结构搞砸了一样。

It's as if IE9's internal data structures are getting messed up.

如果这引起了您的兴趣,请查看
http://www.ncf.ca/ncf/support / ie9_issue
了解有关问题的更多信息以及页面的HTML。

If this intrigues you, have a look at http://www.ncf.ca/ncf/support/ie9_issue for more info about the problem, and the page's HTML.

这是在Win7上使用IE9,FF4,Chrome10运行的,所有这些都被认为是最新的。

This was run on Win7 using IE9, FF4, Chrome10, all believed to be up to date.

推荐答案

我一直在看到类似的问题,在td节点之间有额外的空白区域导致IE9渲染动态生成的表格错误,在我的case 未对齐表格中的单元格。  所有工作正常在IE6,IE7,IE8,FireFox
4,Chrome 10,但不是IE9。 

I've been seeing a similar problem with extra white space between td nodes causing IE9 render a dynamically generated table incorrectly, in my case to misalign a cell within a table.  All worked fine in IE6, IE7, IE8, FireFox 4, Chrome 10, but not IE9. 

在IE9中,我会看到类似这样的内容(其中'X'表示表格单元格):

In IE9 I would see something like this (where an 'X' represents a table cell):

XXXXXXXX

XX XXXXXX  ;&NBSP;&NBSP; < - 缺少单元格3中的单元格,行末的额外单元格

XX XXXXXX    <-- missing cell in spot 3, extra cell at end of row

XXXXXXXX

XXXXXXXX

XXXXX XXX    < - 缺少单元格6中的单元格,行末的额外单元格

XXXXX XXX    <-- missing cell in spot 6, extra cell at end of row

缺少单元格的位置似乎是由IE9随机生成的。  

The location of the missing cell seemed to be randomly generated by IE9.  

一旦我从生成的表格html中取出了一些回车和空格,IE9开始表现得稍好一些,但问题并没有完全消失(它只会显示出来)频率较低)。

Once I took out some carriage returns and spaces out of much of the generated table html, IE9 began to behave somewhat better, but the problem didn't go away completely (it would just show up with less frequency).

无论如何,当我使用以下元标记声明与IE8兼容的页面时,我的特定问题已完全解决:

Anyway, my particular problem was completely resolved when I declared the page to be IE8 compatible using the following meta tag:

< meta http-equiv =" X-UA-Compatible content =" IE-EmulateIE8" >

<meta http-equiv="X-UA-Compatible content="IE-EmulateIE8" >

我不确定添加此元标记的完整后果,但在我测试的所有浏览器中似乎都能正常工作(IE6 / 7/8/9, FF4,Chrome10)。

I'm not sure of the full ramifications of adding this meta tag, but all seems to work fine in all browsers I've tested (IE6/7/8/9, FF4, Chrome10).

如果您正在寻找快速解决方案,它可能也适用于您的方案。

It might work in your scenario as well if you're looking for a quick fix.

 


这篇关于IE9表格布局明显受HTML元素之间的空白影响的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆