Internet Explorer表1像素间距问题 [英] Internet Explorer table 1 pixel spacing problem

查看:83
本文介绍了Internet Explorer表1像素间距问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我发现Internet Explorer与表格间距有关的一个奇怪问题,无法找到解决此问题的方法。一个空的表格会导致带有Internet Explorer的单个像素空白区域(6和7,8尚未测试),而所有其他浏览器忽略空表格。这是问题的图片:

I've found a strange problem with Internet Explorer related to table spacing and cannot find a way to work around it. An empty table results in a single pixel white space with Internet Explorer (6 and 7, 8 not yet tested), while all other browsers ignore the empty table. Here's a picture of the problem:

alt text http://img30.imageshack.us/img30/295/tablepixelbug.png

这里是最小的HTML代码来重现问题(请注意,有更多的边距/填充css属性和表格属性指定比真正需要,我只是测试,如果这可以修复IE的行为):

And here is the minimum HTML code to reproduce the issue (please note that there are more margin/padding css attributes and table attributes specified than really needed, I just tested if this fixes IE's behavior):

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<body>

<div style="width: 200px; border: 1px black solid">
    <table border="0" cellspacing="0" cellpadding="0" 
        style="margin: 0pt; padding: 0pt; border-collapse: collapse;">
        <tr>
            <td style="padding: 0; margin: 0">
            </td>
        </tr>
    </table>

    <div style="background: red">
        Test
    </div>
</div>

</body>
</html>

我没有使用上面示例中指定的空表,但这是最小代码显示此行为。任何想法如何解决这个问题,并删除与IE浏览器的空白?

I'm not using an empty table as specified in the example above, but this was the minimum code that displays this behavior. Any ideas on how to fix this and remove the white space with IE?

推荐答案

我建议你从表中删除样式,只适用它到单元格(甚至不是行)。表格和tr标签上的样式有时会产生副作用。

I suggest you remove styling from table and only apply it to cells (not even rows). Styles on table and tr tags can sometimes produce side effects.

这篇关于Internet Explorer表1像素间距问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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