The answer is even easier than that, Dave!  I should have specified that I
was testing with IE6 in this case.

Recall that I could get expected behavior in quirks mode.  Well...

In quirks, IE6's document.body.clientWidth returns the window, which is
right for the expressions fix.

In standards compliance, IE6's document.body.clientWidth returns the
document, which is wrong for the expressions fix.  Instead, use
document.documentElement.clientWidth.

So the popular expressions fix to the "IE5/6 CSS max-width" bug is a little
differet when IE6 is standards compliant:
max-width: 300px;  /* For all but IE */
width: expression(document.documentElement.clientWidth > 301 ? "300px" :
"auto" ); /* For IE */

For more info, check out: 
http://www.howtocreate.co.uk/tutorials/javascript/browserwindow

BTW - The reason I put slightly different pixel values in the expression
statement is to avoid "a racing condition in IE".  See:
http://www.cameronmoll.com/archives/000892.html


Successful test case:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
<html><head><title>Max-width test</title>
<style type="text/css">
  #resize {
    border: medium double black;
    max-width: 300px;
    width: expression(document.documentElement.clientWidth > 301 ? "300px" :
"auto" );
    margin: 10px;  
  }
</style></head><body>
<div id="resize">Li Europan lingues es membres del sam familie. Lor separat
existentie es un myth. Por scientie, musica, sport etc., li tot Europa usa
li sam vocabularium.</div>
</body></html> 

Cheers,

-Anthony





dave.methvin wrote:
> 
> As soon as I sent I thought of this.
> 
>> width: expression(document.body.clientWidth > 310 ? "300px" : "auto" );
>> margin: 10px expression(document.body.clientWidth > 310 ? "auto" : "10px"
> ) 10px 10px;
>>
>> You might expect  "10px auto 10px 10px" to work but
>> it doesn't; the expression has to be there.
> 
> Yes it does, but this is all the expression has to say:
> 
>  margin: 10px expression("auto") 10px 10px;
> 
> It just seems to need to reapply the "auto" that gets lost at some point.
> 
> 
> _______________________________________________
> jQuery mailing list
> [email protected]
> http://jquery.com/discuss/
> 
> 

-- 
View this message in context: 
http://www.nabble.com/jQuery-fix-to-IE%27s-lack-of-%27max-width%27-CSS-support---tf3025554.html#a8439335
Sent from the JQuery mailing list archive at Nabble.com.


_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to