I'm stuck :)

The desired behavior is in Firefox:  When the window size decreases below a
box's max-width value, the box width is "auto" and shrinks.  I think this is
standard: http://www.w3.org/TR/CSS21/visudet.html#min-max-widths

The popular expressions fix to the "IE5/6 CSS max-width" bug is: 
max-width: 300px;  /* For all but IE */
width: expression(document.body.clientWidth > 301 ? "300px" : "auto" ); /*
For IE */

This works fine until I add a margin to the box.  With a margin, the 'else'
statement in the expression is ignored.  In the example above, the width is
stuck at 300px.

The workaround, for some reason, is to set the DOCTYPE at HTML 3.2 or below,
or to not set the DOCTYPE at all.

jQMinMax, a brilliant and needed plugin, unfortunately does not seem to
offer the "auto" shrinking behavior of max-width.

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.body.clientWidth > 310 ? "300px" : "auto" );
    margin: 10px;  /* DELETE THIS AND EVERYTHING RESIZES AS EXPECTED */
  }
</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>





wycats wrote:
> 
> Any reason not to use IE's expressions?
> 
> Perhaps a plugin that created the appropriate expressions would be useful.
> 
> -- Yehuda
> 
> On 1/17/07, tony rasmus <[EMAIL PROTECTED]> wrote:
>>
>>
>> IE5/6 do not support CSS 'max-width'.
>>
>> I love JQuery, and I wonder if there is a way jQuery can help.  Does
>> anyone
>> know of a jQuery fix to IE's lack of 'max-width'?
>>
>> Cheers,
>>
>> -Tony
>>
>> --
>> View this message in context:
>> http://www.nabble.com/jQuery-fix-to-IE%27s-lack-of-%27max-width%27-CSS-support---tf3025554.html#a8405344
>> Sent from the JQuery mailing list archive at Nabble.com.
>>
>>
>> _______________________________________________
>> jQuery mailing list
>> [email protected]
>> http://jquery.com/discuss/
>>
> 
> 
> 
> -- 
> Yehuda Katz
> Web Developer | Wycats Designs
> (ph)  718.877.1325
> 
> _______________________________________________
> 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#a8423996
Sent from the JQuery mailing list archive at Nabble.com.


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

Reply via email to