<ar**********@yahoo.com> wrote in message
news:11**********************@g14g2000cwa.googlegr oups.com...
I appreciate the help, but the problem is still there.
To recap: A create a div (newDiv) and attach a textNode (myTextNode)
to
my document.
newDiv.appendChild(textNode);
newDiv.style.fontSize = "8pt";
newDiv.style.lineHeight = "10px";
When I call newDiv.style.offsetHeight later in the program, Mozilla
returns 10 as the value, IE6.0 returns 14.
I looked at all the newDiv.style, properties in the debugger. All of
the properties relating to margins have no assigned value.
Could someone please tell me where the 4 extra pixels are coming from
and how to turn them off?
If you remove the setting of -lineHeight-, then both Firefox 1.0 and IE
6.0.2900 report the same value (14):
<div id="test"></div>
<script type="text/javascript">
var textNode = document.createTextNode("Hi");
var newDiv = document.getElementById('test');
newDiv.appendChild(textNode);
newDiv.style.fontSize = "8pt";
// newDiv.style.lineHeight = "10px";
alert(newDiv.offsetHeight);
</script>
So it's pretty evident that offsetHeight in IE is the offsetHeight of
the <div> disregarding the smaller -lineHeight- you are attempting to
set. Whether this is "correct" or not is a matter of debate. Personally
I think it's dangerous to set a font as a point size, then insist the
line height is a pixel height. Since different devices and platforms use
different DPI values it seems like this is a recipe for
non-cross-browser compatible code CSS.
So the "extra" 4 pixels aren't extra after all, they are part of the
height of the <div> when you put an 8pt font inside it.
--
Grant Wagner <gw*****@agricoreunited.com>
comp.lang.javascript FAQ -
http://jibbering.com/faq