如何在表列中嵌套表行?

时间:2014-07-13 05:05:56

标签: html

我正在使用表格以表格格式输出一些数据。 (下面只是我正在使用的一个小例子)我正在尝试创建一个2列布局。两列都包含表行。但我正在尝试将它们创建为表行的容器。

这就是我的代码的外观

    <table>

<tr>


    <td>
    <tr><td>I am nested in a table column </td><td>I am also nested in a table column  </td></tr>
    </td>


    <td>
    <tr><td>I am nested in the second table column </td><td>I am also nested the second table column  </td></tr>
    </td>


</tr>


</table>

但由于某种原因,浏览器呈现的方式不同......

有人可以帮助我,这样浏览器就会像我写的HTML代码一样呈现它吗?谢谢!

<table>

<tr>


    <td>
    <tr><td>I am nested in a table column </td><td>I am also nested in a table column  </td></tr>
    </td>


    <td>
    <tr><td>I am nested in the second table column </td><td>I am also nested the second table column  </td></tr>
    </td>


</tr>


</table>

1 个答案:

答案 0 :(得分:0)

试试这个:

<table>
<tr>
    <td>
    <table>
        <tr>
        <td>I am nested in a table column</td>
        <td>I am also nested in a table column</td>
        </tr>
        <tr>
        <td>I am nested in the second table column</td>
        <td>I am also nested the second table column</td>
        </tr>
    </table>
    </td>
</tr>
</table>

Working fiddle