css - 我怎样才能在 IE 中执行 getComputedStyle

标签 css internet-explorer styles getcomputedstyle

我有一个div,我没有给它设置任何样式,然后我把一些内容放进去,所以它的高度可以增长

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

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

如何获取IE中的高度?

最佳答案

不要使用getComputedStyle,使用clientHeightoffsetHeight取决于您是否希望将边框包含在总数中。

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

关于css - 我怎样才能在 IE 中执行 getComputedStyle,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20136616/

相关文章:

html - 如何将文本 "ON"和 "OFF"添加到切换按钮

jquery - 使用 CSS3 动画或 jQuery 将 div 向下滑动到可见区域

Javascript window.open 在 Win7 x64 上的 32 位 IE8 中返回 null

html - IE8 - 顶部边距为 : 10px has no margin 的容器

java - html 内的样式属性 :text expression error

jquery - 如何更改多选中搜索文本框的占位符?

jquery - $(this).css ("background", "transparent");在 IE 中不工作

Android 系统颜色常数

html - 如何将框阴影添加到包含的 div?

css - 从中间向 div 底部添加 box-shadow