Forum Moderators: not2easy

Message Too Old, No Replies

Min-Width for IE6

         

mumebuhi

12:24 am on Jan 10, 2008 (gmt 0)

10+ Year Member



I came across the following tip (unfortunately, it is the rule that we are not allowed to post link here so I don't include the original post): using Microsoft's dynamic expression to define min-width for IE6. Try Google: "Ten More CSS Trick You May Not Know"!

Basically, the suggested page code looks like this:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style>
#iehack {
min-width: 975px;
width:expression(document.body.clientWidth < 975? "975px": "auto");
}
</style>
</head>

<body>
<div id="iehack" style="border: 1px solid #ff0000">
A MESSAGE
</div>
</body>
</html>

However, the above trick always crashed the IE6. I think this is an awesome trick if it works! Help?

Setek

3:58 am on Jan 10, 2008 (gmt 0)

10+ Year Member



I believe the way to stop IE 6 from crashing with the javascript-expression-css-rule is to have the less-than and the true value to be marginally different:

width:expression(document.body.clientWidth < 975? "970px": "auto");

That should fix it. If it doesn't, increase the value to have larger differences until it doesn't crash :)