为什么我们不应该将块元素放入内联元素中 [英] Why should we not place block elements inside inline elements
问题描述
不在块内嵌元素中放置块级元素的原因是什么?
如果我在块元素中放置div元素,它将使HTML无效。 p>
如果我将一个div元素放置在一个anchor元素中,它会使我的HTML无效。
是什么原因是不是将块级元素放入内联元素中?
HTML规范描述哪些元素可能包含其他元素。 流量内容通常可以包含流量内容或短语内容,但即便如此,情况并非总是如此。例如,一个 p
元素是一个块级元素,但它可能只包含Phrasing Content。
If I place a div element inside an anchor element, it invalidates my HTML.
What is the reason of not placing block level elements inside inline elements ?
If I place a div element inside an anchor element, it invalidates my HTML.
What is the reason of not placing block level elements inside inline elements?
The HTML specification describes which elements may contain other elements. "Flow content" can often contain "Flow Content", or "Phrasing Content", but even this is not always the case. For example, a p
element is a block level element, but it may only contain "Phrasing Content".
这篇关于为什么我们不应该将块元素放入内联元素中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!