PDA

View Full Version : IE Image width bug (percent not realative to parent)



eletero
07 Feb 2007, 12:16 PM
Ok, this may be a well known problem but I can't find a solution (if one exists)


Looking at the below page in Firefox and IE6 (not sure about 7) gives different results

http://www.cs.nott.ac.uk/~mhl/tableTest.html


It seems to me that for the following "<IMG WIDTH="50%"...."

IE6 seems to treat the 50% as the amount by which to scale the image. ie., 50% of original image size.

What it should actually is set the width of the image (object in general) to "50%" of the containing parent size, ie., "50%" of the td width.

Firefox behaves correctly as far as I can tell.


Is there anyway to fix this for IE users?


Thanks

Wickham
07 Feb 2007, 03:25 PM
Table 2 isn't working as you expect either. The left cell in Table 2 is width="15%" but the image is much larger so the cell is much wider than 15% because it expands to fit the image.

Firefox and IE treat percentage widths differently so you will have to think of another way.

Javascript could probably do it by giving a name to the left cell, translating the 15% width into px for the screen resolution being used and taking half that width for the image inside. It's beyond my capabilities.
edit--------------
I've just found this:-
http://css-discuss.incutio.com/?page=UsingPercent
Open this example and make the window smaller then drag the window bigger or smaller:-
http://www.rock-on-rock-on.com/

It uses divs, not tables.