views:

20

answers:

1

I am working with a web application that is designed to run on IE quirksmode (it was initially designed a few years ago). I was trying to do something with absolute positioning in it, but it did not work as I expected. I have a simplified example illustrating my issue. Please see below.

<html>
<head>
<title></title>
</head>
<body>

<div id="1" style="background: yellow; width: 600px; height: 400px">
   <div id="2" style="background: green; position: absolute;">
      A long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long text
   </div>
</div>

</body>
</html>

I would expect the div with id 2 to take the width of the document. And this does happen in Firefox and IE in standards mode. In quirks mode, the div's width is still constrained by the container (in fact more so - it has an extra margin on the right).

Is there some way I can get this behaviour to happen in IE in quirks mode? Thanks!

A: 

Sure, you could do it with a CSS expression that sets <div id"two">'s width to that of the document. Something like the following in an IE only stylesheet:

#two {
    width: expression(document.body.clientWidth);
}

Just as a note - I changed the id from 2 to two since the id attribute can't start with a number.

Pat