Usually, we get an element's size by offsetWidth/offsetHeight, set them by style.width/style.height. However, these two groups are actually not same. The following stuff applies for IE/Firefox/Chrome.
As we know, an element's space is composed of padding, border, margin and client area. offsetWidth and offsetHeight are the sum of all those properties. However, style.width and style.height behaves different on different browsers. For IE, it's same with offsetWidth and offsetHeight; For Firefox and Chrome, padding is not included in style.width and style.height.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment