Reputation:
Consider the following HTML markup:
<div>
<span>Some text</span>
<span>Another some text</span>
<p>This is <s>sparta</s> paragraph</p>
</div>
In the spec in sec. 9.2.1 said the following:
A block container box either contains only block-level boxes or establishes an inline formatting context and thus contains only inline-level boxes.
Is it true that two neighbor span
elements are wrapped in an anonymous block?
Upvotes: 0
Views: 106
Reputation: 437574
No, in the sense that you won't find an anonymous block in the DOM.
But for the purposes of layout, you can think of those elements as if they were in fact enclosed in an anon block; to put it differently, explicitly wrapping them in an unstyled block element will not result in any observable layout difference.
The purpose of this rule is most likely (I 'm not a W3C insider) to reduce the number of possibilities that a layout engine has to deal with and thus make implementing and validating one easier.
Upvotes: 1