0

这个 HTML 表格被一些浏览器误解了,我不明白为什么:

Chrome 和 Outlook显示我期望的渲染,其中第 2 行和第 3 行的第 2 个单元格通过第 4 到第 10 行的第 4 个单元格。

Chrome 渲染截图 http://www.team-logics.com/public/stackoverflow/2010-12-05-Chrome.png

Internet Explorer 8 和 Opera 10显示的内容有所不同,第 4 行到第 10 行的第 4 个单元格“开始于”第 2 行和第 3 行的第 2 个单元格。

Internet Explorer 8 渲染截图 http://www.team-logics.com/public/stackoverflow/2010-12-05-IE.png

任何猜测为什么我的 colspans et rowspans 没有以同样的方式解释?哪些浏览器是正确的?如何安排我的代码,使它们都像 Chrome 一样呈现?

我的实际代码:(对不起,脏代码,这是一个电子邮件签名)

<table border=0 cellspacing=0 cellpadding=0 width=400 style='width:300pt;border-collapse:collapse;border:1px solid black;'>
 <tr style='height:9.75pt'>
  <td colspan=6 valign=top style='border:1px solid black;height:9.75pt;width:300pt;' width="400">
  </td>
 </tr>
 <tr style='mso-yfti-irow:1;height:12pt' height="16">
  <td rowspan=9 valign=top style='border:1px solid black;height:12pt;width:14.25pt' width="19">
  </td>
  <td bgcolor="red" colspan=3 valign=top style='border:1px solid black;height:12pt;width:203.25pt;' width="271">
  </td>
  <td rowspan=2 valign=top style='border:1px solid black;height:12pt;width: 72pt' width="96">
  </td>
  <td rowspan=2 valign=top style='border:1px solid black;height:12pt;width:10.5pt' width="14">
  </td>
 </tr>
 <tr style='mso-yfti-irow:2;height:12pt' height="16">
  <td bgcolor="red" colspan=3 valign=top style='border:1px solid black;height:12pt;width:203.25pt;' width="271" height="16">
  </td>
 </tr>
 <tr style='mso-yfti-irow:3;height:3.75pt' height="5">
  <td colspan=2 valign=top style='border:1px solid black;height:3.75pt;width:170.25pt' width="227" height="5">
  </td>
  <td colspan=3  rowspan=7 valign=top style='border:1px solid black;height:3.75pt;width:115.5pt' width="154">
  </td>
 </tr>
 <tr style='mso-yfti-irow:4;height:11.25pt' height="15">
  <td valign=top style='border:1px solid black;height:11.25pt;width:27.75pt' width="37">
  </td>
  <td valign=top style='border:1px solid black;height:11.25pt;width:142.5pt' width="190">
  </td>
 </tr>
 <tr style='mso-yfti-irow:5;height:11.25ptpt' height="15">
  <td valign=top style='border:1px solid black;height:11.25pt;width:27.75pt' width="37" height="15">
  </td>
  <td valign=top style='border:1px solid black;height:11.25pt;width:142.5pt' width="190" height="15">
  </td>
 </tr>
 <tr style='mso-yfti-irow:6;height:3.75pt' height="5">
  <td colspan=2 valign=top style='border:1px solid black;height:3.75pt;width:170.25pt' width="227">
  </td>
 </tr>
 <tr style='mso-yfti-irow:7;height:11.25pt' height="15">
  <td colspan=2 valign=top style='border:1px solid black;height:11.25pt;width:170.25pt' width="227" height="31" >
  </td>
 </tr>
 <tr style='mso-yfti-irow:8;height:23.25pt' height="31">
  <td colspan=2 valign=top style='border:1px solid black;height:23.25pt;width:170.25pt' width="227">
  </td>
 </tr>
 <tr style='mso-yfti-irow:9;mso-yfti-lastrow:yes;height:50.25pt' height="67">
  <td colspan=2 valign=top style='border:1px solid black;height:50.25pt;width:170.25pt' width="227">
  </td>
 </tr>
</table>
4

2 回答 2

1

我不确定在哪里发布这个问题,所以我也在 DocType 上发布了它。

我在那里得到了答案:http: //doctype.com/incorrect-internet-explorer-8-colspan-interpretation

我还必须在我的 .

于 2011-01-10T14:49:40.753 回答
0

对于许多列来说,这可能无济于事,您同时拥有 CSS 宽度(在 style 属性中指定)和实际宽度。这两个值似乎不同,我怀疑浏览器决定使用哪个值的方式有所不同。尝试删除重复项,看看会发生什么。

于 2010-12-06T09:39:06.370 回答