如何在标签内表上显示数据?

时间:2016-05-21 15:58:08

标签: html css html-table

如何在<td>代码内部表格上显示数据?

通过下面的代码,当加载页面时,它将显示如下图像:

http://image.free.in.th/v/2013/ir/160521040137.png

但我想在111标记之上显示<td>,如下图所示:

http://image.free.in.th/v/2013/io/160521040244.png

我该怎么做?我尝试了所有的东西,但它不起作用。

<table>
    <tbody>
        <tr>
            <td style="width: 100px;-ms-word-wrap: break-word;word-wrap: break-word;-ms-word-break: break-word;word-break: break-word;word-break: break-all;padding-left: 10px;border: 1px solid #d0d0d0;text-align: center;">111</td>
            <td style="width: 600px; -ms-word-wrap: break-word; word-wrap: break-word; -ms-word-break: break-word; word-break: break-word; word-break: break-all; padding-left: 10px; border: 1px solid #d0d0d0; ">
dsgfdhgdffdsgfdhgdffdsgfdhgdffdsgfdhgdffdsgfdhgdffdsgfdhgdffdsgfdhgdffdsgfdhgdffdsgfdhgdffdsgfdhgdffdsgfdhgdffdsgfdhgdffdsgfdhgdffdsgfdhgdffdsgfdhgdffdsgfdhgdffdsgfdhgdffdsgfdhgdffdsgfdhgdffdsgfdhgdffdsgfdhgdffdsgfdhgdffdsgfdhgdffdsgfdhgdffdsgfdhgdffdsgfdhgdffdsgfdhgdffdsgfdhgdffdsgfdhgdffdsgfdhgdffdsgfdhgdffdsgfdhgdffdsgfdhgdffdsgfdhgdffdsgfdhgdfdsgfdhgdffdsgfdhgdffdsgfdhgdffdsgfdhgdffdsgfdhgdffdsgfdhgdffdsgfdhgdffdsgfdhgdffdsgfdhgdffdsgfdhgdffdsgfdhgdffdsgfdhgdffdsgfdhgdffdsgfdhgdffdsgfdhgdffdsgfdhgdffdsgfdhgdffdsgfdhgdffdsgfdhgdffdsgfdhgdffdsgfdhgdffdsgfdhgdffdsgfdhgdffdsgfdhgdffdsgfdhgdffdsgfdhgdffdsgfdhgdffdsgfdhgdffdsgfdhgdffdsgfdhgdffdsgfdhgdffdsgfdhgdffdsgfdhgdffdsgfdhgdffdsgfdhgdfdsgfdhgdffdsgfdhgdffdsgfdhgdffdsgfdhgdffdsgfdhgdffdsgfdhgdffdsgfdhgdffdsgfdhgdffdsgfdhgdffdsgfdhgdffdsgfdhgdffdsgfdhgdffdsgfdhgdffdsgfdhgdffdsgfdhgdffdsgfdhgdffdsgfdhgdffdsgfdhgdffdsgfdhgdffdsgfdhgdffdsgfdhgdffdsgfdhgdffdsgfdhgdffdsgfdhgdffdsgfdhgdffdsgfdhgdffdsgfdhgdffdsgfdhgdffdsgfdhgdffdsgfdhgdffdsgfdhgdffdsgfdhgdffdsgfdhgdffdsgfdhgdffdsgfdhgdf
            </td>    
        </tr>
        <tr>
            <td style="width: 100px;-ms-word-wrap: break-word;word-wrap: break-word;-ms-word-break: break-word;word-break: break-word;word-break: break-all;padding-left: 10px;border: 1px solid #d0d0d0;text-align: center;">222</td>
            <td style="width: 600px; -ms-word-wrap: break-word; word-wrap: break-word; -ms-word-break: break-word; word-break: break-word; word-break: break-all; padding-left: 10px; border: 1px solid #d0d0d0; ">
dsgfdhgdffdsgfdhgdffdsgfdhgdffdsgfdhgdffdsgfdhgdffdsgfdh
            </td>    
        </tr>
    </tbody>
</table>

3 个答案:

答案 0 :(得分:1)

添加vertical-align:top;,你就可以了。

Here's a fiddle添加此内容。

编辑:将这些内联代码放在一个类中并使用它!

答案 1 :(得分:1)

您可以使用

 <td style="...; vertical-align: top;">...</td>

答案 2 :(得分:1)

您可以在此处添加CSS

table td { 
  display: table-cell;
  vertical-align: top; 
}

这可以帮助您编写一次代码并为表的所有<TD>...</TD>执行操作。