在UL中允许除了LI吗? [英] Is anything except LI's allowed in a UL?
问题描述
我们从我们的设计人员那里得到了一些可疑的HTML。以下有效吗? (注意UL中的UL)
We're getting some suspicious HTML from our designer. Is the following valid? (note the UL inside the UL)
<ul>
<li>1</li>
<ul>
<li>1.1</li>
<li>1.2</li>
<li>1.3</li>
</ul>
<li>2</li>
<ul>
<li>1.1</li>
<li>1.2</li>
<li>1.3</li>
</ul>
</ul>
推荐答案
根据 HTML 4规范, XHTML 2规范和 HTML 4
#ul-element
According to the HTML 4 specs, the XHTML 2 specs and the HTML 5 specs that code is invalid.
<!ELEMENT
UL
- - (LI
) +
<!ELEMENT
UL
- - (LI
)+
这意味着在< ul>
中只能有 $ b
XHTML
This means that inside a <ul>
there can only be multiple <li>
elements.
>
这两种类型的列表(
ul | ol
)都由li
元素。
HTML 5
Content model:
Zero or moreli
and script-supporting elements.
请注意,脚本支持元素是未呈现的元素,目前仅包含< script>
和< template>
。
Note that script-supporting elements are elements that are not rendered, and currently include only <script>
and <template>
.
这篇关于在UL中允许除了LI吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!