简体   繁体   English

IE9中的表呈现问题

[英]Table rendering problem in IE9

I'm not certain the problem is with IE9 and not other browsers, but I think that's a safe starting assumption. 我不确定问题出在IE9,而不是其他浏览器,但是我认为这是一个安全的开始假设。

When viewing this web site in IE9, I get a black horizontal line between the rows of the main layout table. 在IE9中查看此网站时,在主布局表的行之间出现一条黑色的水平线。 This is not visible in Firefox 4 and Chrome. 这在Firefox 4和Chrome中不可见。

The body background is black, so I'm assuming there is a small gap between each of the rows. 主体背景为黑色,因此我假设每行之间都有一个小的间隙。 The table declaration includes the following attributes, and there are no CSS rules in effect. 表声明包含以下属性,并且没有有效的CSS规则。

border="0" align="center" cellpadding="0" cellspacing="0"

What is most likely to be causing this? 是什么最有可能导致这种情况?

The problem is that you have too much text in the cell with rowspan. 问题是带有行距的单元格中的文本过多。 It simply forces the table to be higher so that the images aren't high enough to cover their cells. 它只是迫使表格更高,以使图像不足以覆盖其单元格。

If you want to fill the cell with text to get the last paragraph exactly at the bottom (or just to use all of the available space in the cell), then you have to set the exact size of every element in the cell to override the different margins, paddings and line heights that different browsers have. 如果您想用文本填充单元格以使最后一段恰好位于底部(或仅使用单元格中的所有可用空间),则必须设置单元格中每个元素的确切大小以覆盖不同的浏览器具有不同的边距,内边距和行高。

Another alternative to put a paragraph at the bottom is to use absolute positioning. 将段落放在底部的另一种方法是使用绝对定位。 Then the layout is not as sensetive to variations between browsers. 然后,布局对于浏览器之间的变化不太敏感。

And, as John pointed out, you should of course have a doctype on the page so that it renders in Standards Compliance Mode instead of Quirks Mode, that will also help to reduce the difference between browsers. 而且,正如John指出的那样,您当然应该在页面上有一个doctype,以便它以Standards Compliance Mode而不是Quirks Mode呈现,这也将有助于减少浏览器之间的差异。

try to add 尝试添加

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

on the first line of html document, or just : 在html文档的第一行,或者只是:

<!DOCTYPE html>

it may help 它可能会有所帮助

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM