Previous Message
Next Message

max-width in IE... bugs and fixes

Sent by manuel razzari on 27 January 2004 23:11


Hello, just wanted to share this findings. HTH someone out there...

Demo page at:
http://ultimorender.com.ar/funkascript/beta/css/max_width.htm

1. Position:absolute inside max-width + relative
------------------------------------------------

Take the classic Svend Tofte's max-width expression:
#container {width:expression((document.body.clientWidth >
778)?"778":"auto")}

If div#container has position:relative;, IE will hide its absolutely
postioned descendants, when it uses the expression to set width to auto.

FIX #1:
If you can afford position:static; when the width is set to auto, just add a
rule to set it so:
#container {position:expression((document.body.clientWidth >
778)?"relative":"static")}


FIX #2:
Use this javascript to redraw absolutely postioned elements. (Won't work on
IE 5.0).
window.onload = function(){
 if (document.getElementById && document.body.clientWidth < 778) {
  /* list below IDs of absolutely positioned elements */
  repaint = ["testAbsoluteDiv1","testAbsoluteDiv2"];
  for (el in
repaint){document.getElementById(repaint[el]).style.visibility="visible";
}}}


2: Float inside max-width
-------------------------

Floated elements inside an element with IE-max-width will appear/disappear
randomly if you don't asign position:relative; to the float. However this
fix might cause disappearing adjacent text lines.

As usual, play with ingredients until it suits your mix..

-manuel

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