You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Block elements can contain either block or inline elements.
This seems to imply that paragrahps can contain block elements. Unfortunately, this is wrong: the content model for P element allows only phrasing content (HTML5 analog of HTML4's "inline elements"), and, since the end tag for P is optional (again, in contradiction to Block and inline elements section saying that all block elements always have closing tags) it gets implicitly closed just before any 'block' element opening tag, resulting in this new block element being its sibling, not child. It seems to be quite a common confusion for beginners (example).
Moreover, the tutorial claims that it is on HTML5, but HTML5 doesn't have terms 'block and inline elements' at all. It has 'flow content' and 'phrasing content' instead. Aside from being unable to explain why some block elements can contain other blocks and some block elements can't, the oversimplified 'block vs. inline' classification leads many beginners to false conclusion that an element can be converted from one kind to another just by changing its CSS display property (because its values sound the same).
Wouldn't it be better to use HTML5 terms in the HTML5 tutorial instead of HTML4 terms, and introduce the true "Content model" concept instead of oversimplified heurisitic rules with too many exceptions? It might be harder to get from start, but it will lead to much deeper understanding of the topic and much less confusion in the practice.
The text was updated successfully, but these errors were encountered:
The HTML block and inline elements section lists paragraphs (
<p>
) as block elements. The HTML hierarchy section states thatThis seems to imply that paragrahps can contain block elements. Unfortunately, this is wrong: the content model for
P
element allows only phrasing content (HTML5 analog of HTML4's "inline elements"), and, since the end tag forP
is optional (again, in contradiction to Block and inline elements section saying that all block elements always have closing tags) it gets implicitly closed just before any 'block' element opening tag, resulting in this new block element being its sibling, not child. It seems to be quite a common confusion for beginners (example).Moreover, the tutorial claims that it is on HTML5, but HTML5 doesn't have terms 'block and inline elements' at all. It has 'flow content' and 'phrasing content' instead. Aside from being unable to explain why some block elements can contain other blocks and some block elements can't, the oversimplified 'block vs. inline' classification leads many beginners to false conclusion that an element can be converted from one kind to another just by changing its CSS
display
property (because its values sound the same).Wouldn't it be better to use HTML5 terms in the HTML5 tutorial instead of HTML4 terms, and introduce the true "Content model" concept instead of oversimplified heurisitic rules with too many exceptions? It might be harder to get from start, but it will lead to much deeper understanding of the topic and much less confusion in the practice.
The text was updated successfully, but these errors were encountered: