我怎样才能在IE中使用getComputedStyle

时间:2013-11-22 03:41:11

标签: css internet-explorer styles getcomputedstyle

我有一个div并且我没有设置任何样式,然后我将一些内容放入其中,因此它的高度可能会增长

现在我想在IE8或IE7中获得它的高度,它没有getComputedStyle方法

如果我使用currentStyle属性,则返回值为auto,而不是数字;

如何在IE中获得高度?

1 个答案:

答案 0 :(得分:2)

请勿使用getComputedStyle,使用clientHeightoffsetHeight,具体取决于您是否希望在总数中包含边框。

https://developer.mozilla.org/en-US/docs/Determining_the_dimensions_of_elements