§ ITPOW >> 文档 >> CSS

IE 6 line-height 对 offsetHeight 的影响

作者:vkvi 来源:ITPOW(原创) 日期:2011-6-7

实际上 IE 6、7、8、9 都有本文提到的问题。

如上代码,这个 a 的 offsetHeight 是多少?

  • 在 Chrome 中,这个 a 的 offsetHeight 也就只有文字的高度。
  • 而在 IE 6中,这个 a 的 offsetHeight 受 line-height 影响:从文字顶部到 line-height 底部的长度。在本示例中,默认的 IE 6 配置上,a 的 offsetHeight 值是 59。

但是,虽然 offsetHeight 受 line-height 的影响,但纯属占到茅司不屙屎,因为多出来的部分,根本不受 background、mouseover 等的影响。

相关文章