天天看點

01_關于幽靈空白節點檢測時:div内span标簽為什麼要設定一個inline-block的解釋

幽靈空白節點存在于行框盒子的前面(必要條件 :需要h5的文檔聲明)(表現形式:沒有寬度,永遠透明,不能通過腳本擷取)

因為有現成的提問和回答,是以将截圖摘于此。

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

提問:

01_關于幽靈空白節點檢測時:div内span标簽為什麼要設定一個inline-block的解釋

回答:

01_關于幽靈空白節點檢測時:div内span标簽為什麼要設定一個inline-block的解釋

最後,感謝兩位前輩提供的精确回答。

附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.