01_关于幽灵空白节点检测时:div内span标签为什么要设置一个inline-block的解释

幽灵空白节点存在于行框盒子的前面(必要条件 :需要h5的文档声明)(表现形式:没有宽度,永远透明,不能通过脚本获取)

因为有现成的提问和回答,所以将截图摘于此。

原文地址:https://segmentfault.com/q/1010000014296346/a-1020000014298050

提问:

01_关于幽灵空白节点检测时:div内span标签为什么要设置一个inline-block的解释_第1张图片

回答:

01_关于幽灵空白节点检测时:div内span标签为什么要设置一个inline-block的解释_第2张图片

最后,感谢两位前辈提供的精确回答。

附w3c规范:

Line boxes are created as needed to hold inline-level content within an inline formatting context. Line boxes that contain no text, no preserved white space, no inline elements with non-zero margins, padding, or borders, and no other in-flow content (such as images, inline blocks or inline tables), and do not end with a preserved newline must be treated as zero-height line boxes for the purposes of determining the positions of any elements inside of them, and must be treated as not existing for any other purpose.

你可能感兴趣的:(前端css)