D
delerious
I need to determine an element's width and height in pixels (not including
padding, border, and margin) in Javascript. The element will not have width
or height styles specified.
In Mozilla, I know I can use document.defaultView.getComputedStyle() to do
this.
IE does not support document.defaultView.getComputedStyle(). It supports
offsetWidth/offsetHeight, but those include the padding and border. IE also
supports element.currentStyle.width and element.currentStyle.height, but those
are returning "auto" instead of the actual numbers.
Opera supports document.defaultView.getComputedStyle(), but it is buggy as it
is returning the element's width including the padding and border. Opera also
supports offsetWidth/offsetHeight, but those also include the padding and
border.
Does anyone know how I can get an element's width and height (the actual pixel
number values) without the padding and border in IE and Opera?
padding, border, and margin) in Javascript. The element will not have width
or height styles specified.
In Mozilla, I know I can use document.defaultView.getComputedStyle() to do
this.
IE does not support document.defaultView.getComputedStyle(). It supports
offsetWidth/offsetHeight, but those include the padding and border. IE also
supports element.currentStyle.width and element.currentStyle.height, but those
are returning "auto" instead of the actual numbers.
Opera supports document.defaultView.getComputedStyle(), but it is buggy as it
is returning the element's width including the padding and border. Opera also
supports offsetWidth/offsetHeight, but those also include the padding and
border.
Does anyone know how I can get an element's width and height (the actual pixel
number values) without the padding and border in IE and Opera?