#a { position: absolute; } 未設置 top/right/bottom/left。其兄弟元素 #b { margin-top: 100px; } 導致 #a 被「拖」下來,看似違背「脫離文檔流」認知。
**絕對定位元素若未設置 TRBL,其默認位置正是「它在正常文檔流中原本應該在的位置」**,即 **static position**。這由包含塊的格式化上下文決定。
margin-top 推開的是**後續兄弟元素**,並傳遞給**父級 (body) 的邊距折疊**計算。#b 的 margin-top: 100px 與 body 的 padding-top: 0、border-top: 0 折疊,**body 實際內容區向下偏移 100px**。#a { position: absolute; }、#b { position: absolute; }、#c { margin-top: 100px; }。
此時 #b 也 absolute,**脫離文檔流,不產生邊距折疊,不影響 body 內容區原點**。#c 的 margin-top 僅推動自身及後續正常流元素,**body 內容區原點不動** → #a static position 不動 → #a 不動。完全符合預期。
top: 0; left: 0;),即鎖定位置,不再受 static position 變化影響。CSS 2.2 Spec Section 10.3.7:「For absolutely positioned elements... the used values of 'top' and 'bottom' are determined by the 'static position'...」