Click to See Complete Forum and Search --> : div position:absolute; width: 100%, IE problems


rf1
06-23-2007, 04:54 PM
Hi, I'm having some problems with div widths on IE 6 and 7.
What I'm trying to do is have a div with absolute position cover the whole window horizontally, but this div is in a table cell which of course isn't covering the whole window horizontally.

...
<td width="100px">
<div id="floating" style="position:absolute; left:0px; top:0px; width:100%">
</div>
</td>
...

So when I do this and test it in Firefox, Safari, etc. it works fine, covers the whole window... but in IE it doesn't... my guess is that IE is taking 100% as a hundred percent of the width of the containing element (td in this case), not of the whole window as it should because of absolute positioning.

I tried placing the div outside the td element and it worked fine...

how can I work around this problem?

Thanks!

Centauri
06-23-2007, 08:03 PM
I tried placing the div outside the td element and it worked fine...

how can I work around this problem?

You answered the question - DON'T put it in a table cell. There should NEVER be any reason to use a div inside a table cell - tables are for tabular data and should not be used for anything elese.

rf1
06-24-2007, 03:49 AM
You answered the question - DON'T put it in a table cell. There should NEVER be any reason to use a div inside a table cell - tables are for tabular data and should not be used for anything elese.

That's the thing... I can't put it outside a table cell... it's for a myspace profile, is there anything I can do?