偏移高度计算

时间:2012-06-21 13:08:45

标签: javascript html

当我在函数中使用offsetHeight时,对于所有浏览器,offsetHeight结果对于不同的浏览器是不同的。

对于所有人来说,结果是否相同??

对于Firefox,我得到40和IE 38.对于所有浏览器都可以是相同的

 <body>
  <div id="container">
     <div id="richText">
        Resi9 is het volledige gamma modulaire apparatuur integreerbaar in modulaire kasten voor woningen en andere residentiële toepassingen.<br>
        Het omvat de volgende productfamilies :

    </div>

  </div>

<script>

var height=document.getElementById("richText").offsetHeight;

alert("height" + height);



</script>
 </body>

1 个答案:

答案 0 :(得分:0)

您使用@ font-face吗?某些浏览器可能不支持@ font-face或woff2字体,在这种情况下,它将使用本地字体文件,从而导致offsetHeight有所不同。

相关问题