Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DIV in a DIV, width: 50%; is NOT 50%. Bug in IE5.0?

Status
Not open for further replies.

JNeave

Programmer
Jan 28, 2002
125
GB
Hi, here's the code.

Code:
<DIV style=&quot;width: 100%; height: 450px; border: 1px solid black;&quot;>
   <DIV style=&quot;width: 50%; height: 100%; border: 1px solid fuchsia&quot;>
   </DIV>
   <DIV style=&quot;width: 50%; height: 100%; left: 50%; border: 1px solid aqua;&quot;>
   </DIV>
</DIV>

The 50% width only appears to be about 45% in IE5.0.
I can corect this with a javascript bi at the end of the page

divLeft.style.width = (divMain.offsetWidth / 2).toString() + &quot;px&quot;;

That sets the width to TRUE 100%. But I have A LOT of DIVs. And then this won't resize with the screen (for different res') unless I write my own events on window_resize.

Am I doing something wrong? Or is this a bug in IE5?

Can anybody stick this code into IE 5.5 or 6 please?

ta,

Jim.
 
There is a bug in IE5x PC. As far as I know the bug causes it to take it as a percentage of the window NOT a percentage of the parent element! I had big fu**** problems with this recently.

This may not be the cause of your problem, but I found a work-around. Check the bottom of this page for details:




É

- :: my FIRST site in XHTML, comments/ criticism/ questions much appreciated!! :)
-
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top