Skip to content


offsetHeight在ie和ff下的差异

当你的html没设DTD时,设置一个div并包含一张图片,ie的offsetHeight会多出4个象素。

解决方法是去掉img标签后的换行.让后紧跟

或者使用js来判断浏览器。

当你设一div width=50px border=1px,ie的offsetHeight和clientHeight分别是50px和48px,ff是52px和50px

Posted in HTML/XHTML/CSS, JavaScript/DOM/XML, 技术.


No Responses (yet)

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.



Some HTML is OK

or, reply to this post via trackback.