テーブルタグの内側でセルの外側に要素を配置することは悪い習慣ですか、それとも何らかの理由でアンコシャーですか?
例えば:
<table>
<tbody>
<td>Hello,</td>
<td>Help me I'm a table cell.</td>
<td>I'm just happy to be here.</td>
</tbody>
<a>close button</a>
</table>
はい、テーブルの外またはセルの中に入れます。
有効なHTMLhttp: //validator.w3.org/checkを確認する場合は、これを使用します。次のエラーが表示されます。
The element named above was found in a context where it is not allowed. This could mean that you have incorrectly nested elements -- such as a "style" element in the "body" section instead of inside "head" -- or two elements that overlap (which is not allowed).
One common cause for this error is the use of XHTML syntax in HTML documents. Due to HTML's rules of implicitly closed elements, this error can create cascading effects. For instance, using XHTML's "self-closing" tags for "meta" and "link" in the "head" section of a HTML document may cause the parser to infer the end of the "head" section and the beginning of the "body" section (where "link" and "meta" are not allowed; hence the reported error).
はい。<a>
の内部に直接許可することはできません<table>
。セルの内側(<td>
または<th>
)またはテーブルの外側に配置します。を使用することもできます<caption>
。
はい、TABLE要素内のように許可されていないコンテキストでA要素が見つからないため、検証エラーが発生します。