Does anonymous inline box contain whitespace?

冷暖自知 提交于 2019-12-24 01:13:14

问题


I read about CSS2.1 Specification, and in "Anonymous inline boxes" section, it shows an example of anonymous inline boxes like this:

<p>Some <em>emphasized</em> text</p>

and it says:

the <p> generates a block box, with several inline boxes inside it. The box for "emphasized" is an inline box generated by an inline element (<em>), but the other boxes ("Some" and "text") are inline boxes generated by a block-level element (<p>). The latter are called anonymous inline boxes because they do not have an associated inline-level element.

then my question is why anonymous inline boxes' contents are "Some" and "text" not something like "Some " and " text" include whitespace?

and what's the meaning of the following paragraph?

White space content that would subsequently be collapsed away according to the 'white-space' property does not generate any anonymous inline boxes.

what's the meaning of "be collapsed away"?


回答1:


The whitespace is just space, it is not styled and cannot be targeted therefore the mention of it is not useful. They only mention it to remind us that if you only had whitespace, such as 5 whitespaces they will all collapse and show only one. And it will still not be able to be targeted but worth the mention.

If there was no words such as "some" and "text" in that example then only white space would appear. But since whitespace cannot be styled and is not a block or inline element then it would just collapse. In other words, no need to worry about whitespace as it is not an element.



来源:https://stackoverflow.com/questions/58434604/does-anonymous-inline-box-contain-whitespace

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!