<李>没有父标签? [英] <li> without parent tags?

查看:95
本文介绍了<李>没有父标签?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用< li> 标签没有父标签是可以的吗?

ie

 < li>一些复制

或者它必须是..

 < UL> (替换您最喜欢的列表类型)
< li>一些副本
< / ul>

相关链接:


解决方案

如果您确定您的意思是正确,遵循标准并验证,那么根据规范,只有OL和UL可以包含LI 。 (菜单和目录已弃用)



如果您确定您的意思是将渲染,那么是。 ,通过第一个定义为OK,您还必须关闭您的LI标签。每个标签必须是自动关闭的( /> )或具有相应的结束标签。 下面是对正确XHTML的快速和简单的解释(说实话,好的HTML应该符合这些没有理由不要。)


Is it ok to use <li> tags without parent tags?

i.e.

<li> some copy

or must it be..

<ul> (substitute your favorite list type)
    <li> some copy
</ul>

Links on the subject:

解决方案

If by OK you mean "correct, follows standards and will validate" then no. Per the spec, only OL and UL can contain LI. (MENU and DIR are deprecated)

If by OK you mean "will render" then yes.

Also, to be "OK" by the first definition, you must also close your LI tags. Every tag must either be self-closing (/>) or have a corresponding closing tag. Here's a quick and simple explanation of correct XHTML (and honestly, good HTML should conform to these as well. No reason not to.)

这篇关于&LT;李&GT;没有父标签?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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