w3c css 2.1文档匿名块盒例子的问题

在 css 2.1 文档当中匿名块盒一章中提到了两个例子。

第二个例子提到,当一个行内盒 inline box 包含一个文档流内 In-flow 的块级盒,这个行内盒(及在同一行盒的 Line Box 它的行内祖先)会在该块级盒(及其连续的或者中间只被可折叠空白、脱离文档流元素分隔的块级同胞)的周围打断,把行内盒分离成两个盒(甚至一边为空也如此),各在块级盒一边。在打断之前和打断之后的行盒 Line Box 都被匿名块盒包含,并且该块级盒成为匿名块盒的同胞。当这样的行内盒受到相对定位影响,任何产生的移动同样影响到包含在其中的块级盒。

但是看第二个例子实际的效果感觉是匿名行内级盒,而不是匿名块盒!求大牛解释下!

我猜测是不是不可替换的行内块属于块容器盒的一种,而匿名块盒则包含了块容器盒,所以不可替换的行内块也在作匿名块盒的范围之内!但是如果按块盒的定义来看,这是不成立的!

阅读 3.1k
1 个回答

翻译问题,这个翻译版本是作者机翻之后改的,看起来还是很艰难,还是要看原文。

When an inline box contains an in-flow block-level box, the inline box (and its inline ancestors within the same line box) are broken around the block-level box (and any block-level siblings that are consecutive or separated only by collapsible whitespace and/or out-of-flow elements), splitting the inline box into two boxes (even if either side is empty), one on each side of the block-level box(es). The line boxes before the break and after the break are enclosed in anonymous block boxes, and the block-level box becomes a sibling of those anonymous boxes. When such an inline box is affected by relative positioning, any resulting translation also affects the block-level box contained in the inline box.

ifc被分割成两个inline box 贴近他们两个包裹他们自己的anonymous block boxes;

MDN 对视觉格式化模型的翻译比较易读
https://developer.mozilla.org...

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题