Previous Message
Next Message

why doesn't IE recognize min-width ?

Sent by david gee on 2 August 2004 16:04


Zoe M. Gillenwater wrote:
> Shoshannah Forbes wrote:
> 
>> More information on this bug (and a workaround) can be found here:
>> http://www.mezzoblue.com/archives/2004/02/25/sidestepping/
>>  
>>

> The only ways to emulate min-width in IE are to:
> 
> 1. use a spacer gif or div (yucky)
> 2. use scripting (far less repulsive)

More specifically, I'd recommend using behaviors. For example:

<style>
  BODY {
   min-width:740px;
   behavior: url(min-width.htc);
  }
</style>

then create a file called min-width.htc as follows (untested pseudo-script):

<public:component>
<public:attach event="onreadystatechange" onevent="setMinWidth()" />
<script language="javascript" type="text/javascript">
   function setMinWidth() {
     if (this.offsetWidth < 740) {
       this.style.width = "740px";
     } else {
       this.style.width = "100%";
     }
   }
   window.onresize = function() {
     setMinWidth();
   }
</script>
</public:component>

Non-IE browsers will ignore the "behavior" CSS and won't ever see the 
script at all. If you live in your mom's basement and really NEED that 
W3C validation approval, you can throw the "behavior" CSS inside a 
seperate stylesheet called from within conditional comments.

david

______________________________________________________________________
css-discuss [EMAIL-REMOVED]]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/
Previous Message
Next Message

Message thread:

Possibly related: