舊版 CSS 清除浮動方案 .clear { clear: both; font-size: 0; line-height: 0; } 在 IE8 失效。用 IE Developer Toolbar 檢視元素存在,但不生效。
經測試,IE8 對 高度為 0 的元素不納入版面計算。修改為:
.clear { clear: both; font-size: 1px; height: 1px; line-height: 1px; }
即可解決。缺點:頁面會產生 1px 額外空白,實務上影響極小。