Can a td be inside a td

a 夏天 提交于 2019-12-09 08:25:46

问题


It may be a nonsense question, and I know we have to follow standards as much as possible. But can <td> be a direct child of another <td>, like this:

<td class="parent">
    <td class="child">
        <!-- Some info -->
    </td>
</td>

Or it's obligatory to create another <table> with a new <tr> before adding the <td>, which can become heavily populated with table tags and become clustered...


回答1:


not directly but you could place table inside td

<td class="parent">
   <table><tr>
    <td class="child">
        <!-- Some info -->
    </td>
   </tr></table>
</td>



回答2:


No, <td> may not be a child of a <td>. A <td> may only be a child of a <tr>.




回答3:


it's better to create a new table tag.

The example you give is not standard and the behavior can be different from a browser to another one




回答4:


The problem with not following standards like putting a <td> tag inside a <dt>, is that you cannot guarantee that the result is the same for all browsers, or that the next update of any browser will for example not simply ignore wrongly-used tags.

As a sidenote: we, as a developer comunity, have cried and shouted for Internet Explorer to finally start to take the standards seriously, so now let's not start making a mess ourselves!



来源:https://stackoverflow.com/questions/7484826/can-a-td-be-inside-a-td

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!