HTML W3C有效元素 - DIV是否在TD中有效? [英] HTML W3C Valid Elements - Is DIV valid within a TD?
问题描述
我对XHTML很好奇,但不同意在于DIV标记在HTML 4.01中的TD标记中是否有效。
是的。根据HTML 4.01 DTD, td
元素可以包含块级元素和/或内联级元素。
DTD的相关行:
<!ELEMENT(TH | TD) - O(%flow;)* - 表格标题单元,表格数据单元 - >
该行基本上定义了 th
和 td
元素,并声明它们可以包含块和内联元素( *
) >%flow; )。
有关 td
的更多信息: http://www.w3.org/TR/html401/struct/tables。 html#edef-TD
I'm having an argument with a colleague, but can't find the evidence to prove either of us right. I've seen the list of valid elements for given tags before, but just cant find it again. Can anyone point me in the right direction please?
I am curious about XHTML, but the disagreement is specifically over whether a DIV tag is valid within a TD tag in HTML 4.01.
Yes. According to the HTML 4.01 DTD, a td
element can contain block-level elements and/or inline-level elements.
Relevant line of the DTD:
<!ELEMENT (TH|TD) - O (%flow;)* -- table header cell, table data cell-->
This line basically defines the th
and td
elements, and states that they may contain any combination (*
) of block and inline elements (%flow;
).
More info on td
: http://www.w3.org/TR/html401/struct/tables.html#edef-TD
这篇关于HTML W3C有效元素 - DIV是否在TD中有效?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!