Connecting Tech Pros Worldwide Help | Site Map

New CSS rule craches IE !!

  #1  
Old July 21st, 2005, 02:17 AM
Unknown User
Guest
 
Posts: n/a
Today I added this rule to my web site:

#container {
min-width: 950px;
width:expression(document.body.clientWidth < 950? "950px": "auto" );
}

And it crashes IE when the width of the window is less than 950px :(
How would you correct it?

--
Boost the visibility of your web site in Google!
http://www.digitalpoint.com/tools/ad-network/?s=5203

Using Opera's revolutionary e-mail client: http://www.opera.com/mail/

http://www.auriance.com - http://www.auriance.net
  #2  
Old July 21st, 2005, 02:17 AM
Richard
Guest
 
Posts: n/a

re: New CSS rule craches IE !!


On Fri, 04 Mar 2005 14:03:46 -0300 Unknown User wrote:
[color=blue]
> Today I added this rule to my web site:
>
> #container {
> min-width: 950px;
> width:expression(document.body.clientWidth < 950? "950px": "auto" );
> }
>
> And it crashes IE when the width of the window is less than 950px :(
> How would you correct it?
>[/color]

You fix the problem by using a browser that understands the new rules.
You are attempting to utilize a code that older browser just will not
recognize.
Just because a new rule got implemented doesn't cause the browser to
automatically accept it.


Last week you got a speeding ticket for doing 65 in a 55 zone.
This week the law changed the speed limit to 65.
Are you still guilty? Yep.


  #3  
Old July 21st, 2005, 02:17 AM
Martin!
Guest
 
Posts: n/a

re: New CSS rule craches IE !!


Unknown User wrote:[color=blue]
> Today I added this rule to my web site:
>
> #container {
> min-width: 950px;
> width:expression(document.body.clientWidth < 950? "950px": "auto" );
> }
>
> And it crashes IE when the width of the window is less than 950px :([/color]

crash confirmed ! :(
[color=blue]
> How would you correct it?
>[/color]

min-width: 950px;

bad luck, its not supported by Ie

  #4  
Old July 21st, 2005, 02:17 AM
Harlan Messinger
Guest
 
Posts: n/a

re: New CSS rule craches IE !!


Richard wrote:[color=blue]
> On Fri, 04 Mar 2005 14:03:46 -0300 Unknown User wrote:
>[color=green]
>>Today I added this rule to my web site:
>>
>>#container {
>> min-width: 950px;
>> width:expression(document.body.clientWidth < 950? "950px": "auto" );
>>}
>>
>>And it crashes IE when the width of the window is less than 950px :(
>>How would you correct it?[/color][/color]
[color=blue]
>
> You fix the problem by using a browser that understands the new rules.
> You are attempting to utilize a code that older browser just will not
> recognize.
> Just because a new rule got implemented doesn't cause the browser to
> automatically accept it.[/color]

You're misunderstanding the situation. The "expression" code the user
posted *only* works in IE, and he's using it as a work-around for the
fact that IE doesn't recognize the min-width property. It's a trick
that's been posted here from time to time.
  #5  
Old July 21st, 2005, 02:17 AM
Unknown User
Guest
 
Posts: n/a

re: New CSS rule craches IE !!


On Fri, 04 Mar 2005 16:17:34 -0300, Harlan Messinger
<hmessinger.removethis@comcast.net> wrote:
[color=blue]
> You're misunderstanding the situation. The "expression" code the user
> posted *only* works in IE, and he's using it as a work-around for the
> fact that IE doesn't recognize the min-width property. It's a trick
> that's been posted here from time to time.[/color]

That's right. What do you suggest beside a PHP browser detection?

--
Boost the visibility of your web site in Google!
http://www.digitalpoint.com/tools/ad-network/?s=5203

Using Opera's revolutionary e-mail client: http://www.opera.com/mail/

http://www.auriance.com - http://www.auriance.net
  #6  
Old July 21st, 2005, 02:17 AM
phil_gg04@treefic.com
Guest
 
Posts: n/a

re: New CSS rule craches IE !!


> min-width: 950px;[color=blue]
> width:expression(document.body.clientWidth < 950? "950px": "auto" );
> crashes IE when the width of the window is less than 950px :([/color]

Some suggestions:

1. Try IE7 (dean.edwards.name)
2. If IE7 works but it's too slow, work out what is is doing and just
do that. I suspect that it just calls the setExpression method from
javascript and adds an expression very similar, but perhaps subtley
different, to what you have.
3. Put something 950px wide inside the container (e.g. an empty div).
I think this has just about the same effect, doesn't it?
4. Ignore it.

--Phil.

  #7  
Old July 21st, 2005, 02:21 AM
paul haine
Guest
 
Posts: n/a

re: New CSS rule craches IE !!


"Unknown User" <me@privacy.net> wrote in message news:<op.sm4hokjer3xrds@cinza>...[color=blue]
> Today I added this rule to my web site:
>
> #container {
> min-width: 950px;
> width:expression(document.body.clientWidth < 950? "950px": "auto" );
> }
>
> And it crashes IE when the width of the window is less than 950px :(
> How would you correct it?[/color]

I ran into this the other day, after finding the technique at
http://www.svendtofte.com/code/max_width_in_ie/ - I found the
expression was only working when the document was missing a doctype,
thereby putting IE in quirks mode. The solution when in standards mode
is to have something like:

width:expression(document.body.clientWidth < 950? "940px": "auto" );

instead of what you have above.

You could also try this Javascript solution:

http://www.doxdesk.com/software/js/minmax.html

This lets you use min/max-height and min/max-width seamlessly, though
does rely on IE users having Javascript enabled for it to work.

Hope that helps,

paul haine
http://joeblade.com/
http://design.joeblade.com/
  #8  
Old July 21st, 2005, 02:21 AM
kchayka
Guest
 
Posts: n/a

re: New CSS rule craches IE !!


paul haine wrote:[color=blue]
>
> width:expression(document.body.clientWidth < 950? "940px": "auto" );
>
> You could also try this Javascript solution:[/color]

FYI, width:expression also requires JS enabled for it to work

--
Reply email address is a bottomless spam bucket.
Please reply to the group so everyone can share.
Closed Thread