Windows XP Windows 7 Windows 2003 Windows Vista Windows 綜合教學 Linux 系統教學
Windows 10 Windows 8 Windows 2008 Windows NT Windows Server 電腦軟體教學
您现在的位置: Windows教程網 >> Windows教程 >  >> 電腦軟體教學 >> 網路工具

IE8 中關於 margin collapsing 的相容性問題與解決

編輯:網路工具

舊版 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 額外空白,實務上影響極小。

Copyright © Windows教程網 All Rights Reserved