Internet Explorers Expression Property | February 15, 2004

Ever heard of Internet Explorers expression property? Me neither. That was until I read this article.

Posted at February 15, 2004 7:11 PM


Christian said on February 15, 2004 7:35 PM

I just came across that article also when I was looking to see how to control max-width in IE. I’ve used it to do just that in my blog and it seems to work very well. Another addition to the toolbox…

Martijn said on February 15, 2004 8:01 PM

You might wanna check out:
I personally think that’s a better solution.

Chris Vincent said on February 15, 2004 10:28 PM

Yep, IE proprietary. However, it really isn’t that bad of an idea. Perhaps MS should have presented this property to the W3C instead of arrogantly adding it on their own. Then again, one could say that about a thousand other MS actions, so no big surprise.

DarkWulf said on February 15, 2004 10:41 PM

I think this came up earlier, and ended up being mentioned in the same site as the noodle incident with all the box designs…

Anyway, the main argument he presented against it, and one that I am inclined to agree with is that for better or for worse, it doesn’t validate. The last thing we need is to realize 20 years from now when we all use CSS15 that the expression property has been integrated into the spec, but in a completely different way.

So, we have all these old sites that use code in non-valid ways that we don’t remember how to fix because we FORGOT what the reasoning behind it was.

Arguments for such things can be made both ways, I personally hated the min-max javascript solution (lags), and find the expression method cleaner were it not for the fact that it can’t validate.

DarkWulf said on February 15, 2004 10:41 PM

Huh. It didn’t change my url to a link. Lets try it again, ..about validating

David House said on February 16, 2004 10:34 AM

Actually, I have. I use to use it a lot, then switched to Mozilla and learned it was proprietry. Plus, I’m now a lot more familiar with the box model so as to not require DOM calculations.

Jeff Croft said on February 16, 2004 3:08 PM

Interesting. I hadn’t heard of it. I use some of these MS propriatary CSS extensions on projects that must work perfectly in IE, but I always feel sick about it. On my personal site, I stick to stands only. But, in the real world, things often have to work perfectly in IE, and this is very handy to know!

Erik Porter said on February 16, 2004 7:23 PM

A co-worker pointed this out to me and I thought it would be great until I tried it. When I tried it on a page with an XHTML 1.0 transitional doctype IE 6 crashed every time I resized to the width I was testing for. Remove the doctype and it worked again. I tried e-mailing the author and never heard back.

Raena Armitage said on February 17, 2004 7:36 AM

Yeah, I’ve found the minmax script to be easier to manage. The lags don’t bother me so much because, I figure, most of the time they’ll be arriving with their window at a set size, and it’ll stay that way.

mikkeX said on February 17, 2004 9:55 AM

Do anybody have a copy of the doxdesk minmax.js script? It is not on doxdesk anymore…

David Mead said on February 18, 2004 1:15 PM

Seemed to be an answer to my prayers on getting IE to understand a design which needed a min-height value except one thing. It causes IE to crash.

Using XHTML 1.0 transitional the browsers either freezes up or doesn’t pull up the page at all! Strange as it’s a proprietary IE extension.

Nice fix for HTML but avoid if using XHTML.

Erik Porter said on February 18, 2004 2:32 PM

A little more info on the crashing of IE.

In my particular case I was trying to create a centered layout thats width was 80% of the screen but with a min-width of 400px. The containing div I was applying the rule to had a 1px border on all sides. I found that when I removed the border from either the right or the left side it worked, if I had a border on both sides IE crashed.


Trisignia said on February 19, 2004 4:37 PM

That’s great. I first found out about the usability aspects of max-width columns from the maxdesign site, and now use the feature on nearly all my sites.

Johan Svensson said on February 19, 2004 7:54 PM

I’ve predicted for years that CSS would become scriptable sooner or later. Too bad this implementation is proprietary for IE.

Jason Davis said on February 19, 2004 10:00 PM

expression() can be used for lots of things. For example, I’ve managed to cajole it injecting markup to emulate the content: property in various circumstances ( I know Brothercake has adapted my “one-time use” expression() for certain hacks in his accessible dropdown menu (

And so on. Just be careful not to overdo it. And remember that unless you are using a one-time use expression(), it will constantly reevaluatae and hit the performance severely.

My one-time use hack gets around this by replacing:

css-property: expression(js expr);


css-property: expression(“somedefaultvalue”, this.runtimeStyle.cssProperty = js expr);

So it only evaluates once, then is replaced with a non-expression value. :)

Tanny O'Haley said on February 20, 2004 4:08 AM

I use the expression property a lot to implement IE only hacks. It works great. I’m sure that there is a better way to implement IE only hacks, I just don’t know it. I use both XHTML transitional and strict and haven’t had problems with it once I learned you have to add a litting padding to the numbers you are dealing with. For instance:

width : 100%;
min-width: 500px;
width: expression(document.body.clientWidth < 504? “500px”: “100%” )

I also found problems using “auto” as a parameter. I still use this a lot at work as IE is used by around 93% of our public users and 99.9% of our intranet users.

Tom Lee said on March 17, 2006 5:54 PM

For the benefit of all, I’ve posted my own enhancements to Svend’s expression here: