Forum Moderators: not2easy

Message Too Old, No Replies

Found a new (?) IE bug... no good workaround :(

Percent-width causes random effect...

         

MrPete

11:38 pm on Oct 26, 2004 (gmt 0)

10+ Year Member



I have some nice histogram code. But it wasn't working properly in IE. I reduced the problem to this...

The issue:
* Scaling a wide image (my 'bar.jpg' is 616x8) to N percent of the containing object has a random nasty side effect in IE.
* The image itself scales nicely... however
* At random++ The containing object gets expanded to the full (unshrunk) width of the image.
* (++random: without touching anything at all, refresh the browser N times. In my case, I get the wrong effect in IE6 about half the time.)
* The Holly Hack has no effect on this.
* In my simple tests, it only breaks when used in an old-fashioned table. In Real Life, it breaks under many other conditions. One was a complex set of pure <div> code with some hanging indents.
* I'm guessing that once resolved, this may be the real underlying issue for a number of other hassles folks are having.

Question: ANY IDEAS? For now, my only workaround has been to shrink my general-purpose histogram image to something small enough to fit inside any given container.

I give three examples:
* pixel-defined tables solution (always works)
* percent-defined tables solution (half-broken)
* percent-defined div solution (works when this simple)


<?xml version='1.0' encoding='iso-8859-1'?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<style> * html * { /* height: 1px; */ }/* IE hasLayout */
</style>
</head>
<body>
A new (?) and aggravating IE bug:<br/>
Images shrunk in pixels are ok...<br /><br/>
Bar is half (100px) of a 200 pixel red cell.
<table border='1' width='100%'>
<tr><td><p>A resizable cell<p></td>
<td width='200' bgcolor='red'>
<img src='bar.jpg' style='height: 12px; width:100px;' /> fixed histog.</td></tr>
</table><br /><br />
An image shrunk to N percent of container USUALLY 'leaks': its original size makes the container (even a table!) too big...<br/>
Doesn't matter if you use 'style=width' or old fashioned 'width=xyz'<br />
For me, the effect is random: click reload ten times and you see it about half the time.<br/>
Bar should be half (50%) of a 200 pixel red cell.
<table border='1' width='100%'>
<tr><td><p>A resizable cell<p></td>
<td width='200' bgcolor='red'>
<img src='bar.jpg' style='height: 12px; width:50%' /> fixed histog.</td></tr></table><br /><br />
A no-tables version... works when this simple:
<div style='width:100%;border: 1px solid black;'>
<div style='float:right; border:1px solid black;background-color:red;width:200px;'>
<img src='bar.jpg' style='height: 12px; width:50%' /> fixed histog. </div>
<div style='border:1px solid black;'>
A resizable cell</div>
</div>
</body></html>

MrPete

12:00 am on Oct 27, 2004 (gmt 0)

10+ Year Member



Complicating further:

* On my local machine, the simple demo breaks about half the time
* I uploaded the exact same code to a server so you could have access. So far, I can't EVER get it to break when running from there. Same (apache) server.
* In a "real world" situation, not reduced for analysis... it fails 100% of the time in IE.

The ONLY way I could make it work properly was to shrink the underlying graphic.

MrPete

12:09 am on Oct 27, 2004 (gmt 0)

10+ Year Member



Not sure if this will work due to TOS, but here's where I've stashed the example: [ooops]

[edited by: SuzyUK at 11:49 am (utc) on Oct. 27, 2004]
[edit reason] sorry no URLs : see TOS #13 [webmasterworld.com] [/edit]

vkaryl

2:54 am on Oct 27, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome to WebmasterWorld, MrPete. Yup, that addy's kind of crosswise the TOS #13.... [webmasterworld.com]

Did you clear your cache between EVERY TEST INSTANCE? If not, then your test is probably screwed....

Hester

9:44 am on Oct 27, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



For a start, the XML declaration will throw IE into Quirks Mode. The doctype MUST be on the first line in IE. See if it still happens in Standards Mode.

I tested this in IE6 on XP SP2 and can't see anything broken. All 3 examples appear the same?

SuzyUK

12:00 pm on Oct 27, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I too ran it through IE6, IE5.5 and 5 XP PRO SP1 again multiple refreshes and never saw the problem..

Suzy

MrPete

7:03 pm on Oct 27, 2004 (gmt 0)

10+ Year Member



Welcome to WebmasterWorld, MrPete. Yup, that addy's kind of crosswise the TOS #13...

Thanks! (BTW, I'm a bit confused about this interpretation of TOS #13 -- it does NOT say "no links or URL's"... just "don't drop promotional urls..." yet this seems to be interpreted as no URL's at all. Seems to make our lives hard!)

Did you clear your cache between EVERY TEST INSTANCE?

Sure do. Shift-click on reload in IE clears the cache. Found that out the hard way while testing some time-analysis code! It became quite obvious when the time didn't change :). It's an aside but I'm 99.99% certain this always works in both IE and FF/moz.

For a start, the XML declaration will throw IE into Quirks Mode. The doctype MUST be on the first line in IE. See if it still happens in Standards Mode.

Great catch! I wish I could take advantage of this.

I've now learned even more about these modes... (bleah!). Changing to Standards Mode has fixed it, even on local server. (Sadly, using standards mode makes IE even worse for a variety of other page elements. ex: Youngpup's slide menu gets really funky in standards mode :()

I'll have to see if I can get to Standards Mode...

I tested this in IE6 on XP SP2 and can't see anything broken. All 3 examples appear the same?

For me, using the exact example, if run from Apache on my own PC (XP SP1, IE6), it happens quite a lot.

Sounds like I oversimplified the example. On our real site, it breaks 100% of the time. For now, I surrendered and shrank the graphic. No time for more play...

photon

7:49 pm on Oct 27, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



MrPete--

Be sure to take a look at the forum charter [webmasterworld.com] as well (specifically under "Linking"). Different forums have different levels of strictness about various types of postings.

And here's [webmasterworld.com] an in depth discussion about why we're so picky about URLs around here.