简体   繁体   English

跨度可以是 ul 的孩子和 li 的父母吗?

[英]Can a span be a child of an ul and a parent of a li?

From the HTML specs, a li must be a child of an ul , ol or menu .根据 HTML 规范, li必须是ulolmenu的子项。

Permitted parents: An <ul>, <ol>, or <menu> element.允许的父级:<ul>、<ol> 或 <menu> 元素。Though not a conforming usage, the obsolete <dir> can also be a parent.虽然不符合规范的用法,但过时的 <dir> 也可以是父级。

I need a span between an ul and a li :我需要一个ulli之间的跨度:

例子

This does not throw any warnings or errors, but is it correct?这不会引发任何警告或错误,但它是否正确?

No. See the docs related to permitted content at https://developer.mozilla.org/en-US/docs/Web/HTML/Element/ul (and the ones you posted yourself).否。请参阅https://developer.mozilla.org/en-US/docs/Web/HTML/Element/ul上与允许内容相关的文档(以及您自己发布的文档)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM