Html td 可以在 td 内吗

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/7484826/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 10:42:16  来源:igfitidea点击:

Can a td be inside a td

htmlhtml-tablew3cw3c-validation

提问by Shaoz

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>是 another 的直接孩子<td>,像这样:

<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...

或者在添加 之前必须<table>用新创建另一个,它可能会被大量表标签填充并变得聚集......<tr><td>

回答by i100

not directly but you could place table inside td

不是直接的,但你可以把桌子放在 td 里面

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

回答by aioobe

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

不,<td>可能不是<td>. A<td>可能只是 a 的孩子<tr>

回答by Jerome Cance

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

您给出的示例不是标准的,并且行为可能因浏览器而异

回答by Remi

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.

不遵循标准(例如将<td>标签放入 a <dt>)的问题在于,您无法保证所有浏览器的结果都相同,或者任何浏览器的下一次更新都不会简单地忽略错误使用的标签。

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!

作为旁注:我们作为一个开发者社区,为 Internet Explorer 终于开始认真对待这些标准而哭泣和呐喊,所以现在让我们不要开始自己搞砸了!