是<div>
之类的标签, <form>
, <pre>
等..允许在<span>
内?
最佳答案
span
元素是一个内联 元素,它应该只包含其他内联 元素,不包含 block 元素.
来自 the spec :
Generally, block-level elements may contain inline elements and other block-level elements. Generally, inline elements may contain only data and other inline elements. Inherent in this structural distinction is the idea that block elements create "larger" structures than inline elements.
通用 block 级分组元素是 div
。通用内联级分组元素是 span
。
同样,来自 the spec :
The DIV and SPAN elements, in conjunction with the id and class attributes, offer a generic mechanism for adding structure to documents. These elements define content to be inline (SPAN) or block-level (DIV) but impose no other presentational idioms on the content.
关于html - <span> 标签中可以包含任何类型的标签吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5545884/