0

Hi I am very new to CSS.

I have this simple html page which I render in IE 11 standard mode:

<HTML>
<HEAD>
<TITLE> New Document </TITLE>
</HEAD>
<BODY>
<div>Test1</div>
<div style="padding-left: 31px; font-size: 9pt;">
<span style="color: #000000; font-family: Arial; font-size: 9pt;">
<span style="font-family: webdings;">=</span> Test2</span>&nbsp;</div>
<script language="JavaScript">
var divs = document.getElementsByTagName('div');
for(var i=0;i<divs.length;i++){     
var offsetheight = divs[i].offsetHeight;
alert(offsetheight);
}
</script>
</BODY>
</HTML>

This HTML has 2 div elements. The JavaScript in the bottom of the page gets offset height of 2 divs. First Div Offset height is : 18 Second Div offset Height is : 14

If I render the same HTML in Quirks mode. I get different results:

<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8">
</HEAD>
<BODY>
<div>Test1</div>
<div style="padding-left: 31px; font-size: 9pt;">
<span style="color: #000000; font-family: Arial; font-size: 9pt;">
<span style="font-family: webdings;">=</span> Test2</span>&nbsp;</div>
<script language="JavaScript">
var divs = document.getElementsByTagName('div');
for(var i=0;i<divs.length;i++){     
var offsetheight = divs[i].offsetHeight;
alert(offsetheight);
}
</script>
</BODY>
</HTML>

First Div Offset height is : 19 Second Div offset Height is : 19

I want to get offset height from quirks mode in standard mode(i.e. without adding a meta tag). May be through CSS. Let me know if it is possible?

Justinw
  • 631
  • 10
  • 18
Shrinath Shetty
  • 305
  • 2
  • 10
  • Aren't both quirks mode? (And the second is "IE8 quirks mode", I suppose.) Try adding ` ` at the top... – zcorpan Feb 18 '16 at 13:59
  • I gave at the top in the first example. Still getting the same result. Offset Height is : 18 for the first div and 14 for the second div. I want to get the offset heights of the quirks mode without adding a meta tag to emulate IE 8. – Shrinath Shetty Feb 19 '16 at 05:50
  • Try removing `font-size: 9pt;` from the `div`? – zcorpan Feb 19 '16 at 19:27

0 Answers0