在UL中允许除了LI吗? [英] Is anything except LI's allowed in a UL?

查看:130
本文介绍了在UL中允许除了LI吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们从我们的设计人员那里得到了一些可疑的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 HTML 5 specs
代码无效。

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


Conte nt模型

零或更多 li 脚本支持 元素。

Content model:
Zero or more li 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆