Html IE中的图像宽度不合适

Html IE中的图像宽度不合适,html,css,internet-explorer,Html,Css,Internet Explorer,在我的html中,显示红线的表格。在Firefox中,我理解正确。但在IE中,线条的高度增加了。如下图所示 <table width="100%" align="center" border="0" cellSpacing="0" cellPadding="0" summary=""> <tr> <TD style="BACKGROUND-COLOR: red"><IMG alt="" src="myImage.gif" width=1 height=1

在我的html中,显示红线的表格。在Firefox中,我理解正确。但在IE中,线条的高度增加了。如下图所示

<table width="100%" align="center" border="0" cellSpacing="0" cellPadding="0" summary="">
<tr>
<TD style="BACKGROUND-COLOR: red"><IMG alt="" src="myImage.gif" width=1 height=1>
</TD>
</tr>
</table>

在Firefox中:

在IE中:


发生这种情况的原因或我如何解决它。

将此样式添加到表行:

<tr style="height:1px; font-size:1px; line-height:1px;">
    <TD style="BACKGROUND-COLOR: red"><IMG alt="" src="myImage.gif" width=1 height=1>
    </TD>
</tr>

但这并不是为了鼓励内联样式。使用外部样式表

查看此

试试这个

<table width="100%" align="center" border="0" cellSpacing="0" cellPadding="0" summary="">
    <tr>
        <td  style="height:1px; line-height:1px; background-color: red">
            <img alt="" src="myImage.gif" width="1px" height="1px" />
        </td>
    </tr>
</table>

我建议另一种解决方案。此任务不必使用表。 您可能需要使用
div
hr

代码更少,更简单:

被认为不推荐使用的表(在使用它们设置布局样式时),并且您应该尽可能避免使用内联样式。 如果仍在使用表,请尝试将其设置为以下样式:

<table class="clean-table">
...
</table>

我认为最好将css样式的border bottom:1px solid应用于此行

<table style="width: 100%; text-align: center;" cellSpacing="0" cellPadding="0">
    <tr>
        <td>some column</td>
    </tr>
    <tr>
        <td style="height: 1px; line-height: 1px; border-bottom: 1px solid red; background: transparent;"><!-- border --></td>
    </tr>
</table>

某专栏

例如:

try
td{border collapse:collapse}
我错过了什么吗?尝试使用.png而不是.gif。仅仅是.gif文件的大小有时会导致浏览器无法加载图像。
<table style="width: 100%; text-align: center;" cellSpacing="0" cellPadding="0">
    <tr>
        <td>some column</td>
    </tr>
    <tr>
        <td style="height: 1px; line-height: 1px; border-bottom: 1px solid red; background: transparent;"><!-- border --></td>
    </tr>
</table>