有没有解决方案让rowpan在MS浏览器中运行?

时间:2017-01-23 14:39:49

标签: html internet-explorer html-table microsoft-edge

我在http://bikepaths.com/Armstead/GBA1.html有一个网页,我已经设置了一个HTML表来使用rowspan排列文本和图片,这样第一列在高大的图片上方有少量文本,而第二列有在少量文字之上的高大图片。

<table>
    <tr>
        <td>George's first memory of note was ... </td>
        <td rowspan="2"><img src="image/IM-GBA1885.jpg" height="440" width="280"></td>
    </tr>
    <tr>
        <td rowspan="2"><img src="image/IM-JBA4-GBA.jpg" height="400" width="280"> </td>
    </tr>
    <tr>
        <td>Also he recalled watching his half brother, James Benson Armstead IV <i>[on left]</i>, go through .... </td>
    </tr>
</table><br>

所以3行,每个图像单元上的rowspan = 2。 这在Firefox和Chrome中都可以显示,但我尝试的MS浏览器(IE11和Edge)都将其显示为一个简单的2行表格,在每个文本单元格的上方和下方留下了大量空间。

我知道MS应该被禁止创建浏览器,直到他们了解“以下标准”的含义,但在此之前,是否有一种解决方法可以在IE和Edge中正确显示?

1 个答案:

答案 0 :(得分:1)

<table style="table-layout:fixed">
<tr><td></td><td></td><td></td></tr>
<tr><td colspan="3">three colunms width</td></tr>
<tr><td colspan="2">two columns width</td><td>one column</td></tr>
<tr><td colspan="1">one column</td><td colspan="1">one column</td><td colspan="1">one column</td></tr>
</table>

请注意,colspan属性值的总和或每行中td元素数的总和等于第一行(隐藏,因为td单元格为空)所建立的td元素的数量。

转到validator.w3.org/nu并将标记复制并粘贴到直接输入表单中然后按下验证按钮.... w3验证器可以检测td元素的数量和colspan属性的总和不匹配。