Take the 2-minute tour ×

From a blog:

The basic idea with CSS expressions is that you will have calculation and dynamic values for properties in the CSS code, something that people have found very useful. A simple example can be implementing max-width behavior in IE 6:

width: expression(document.body.clientWidth > 1100)? "1100px" : "auto";

This is the first time I read about them. It seems IE used to support CSS expressions but dropped them in IE8. What other browsers still use them and are they generally a good or bad thing?

The blog post I got this from says the alternative is Javascript, but I thought CSS was more supported and therefore better than Javascript.

share|improve this question

3 Answers 3

up vote 5 down vote accepted

AFAIK, it was only ever IE6/7 (maybe) 5.

I never thought they were a good thing. May as well just use JavaScript directly.

They are in fact implemented in JavaScript, and I'm pretty sure disabling JS disables these expressions.

The sample you posted...


...is just a ternary operator that says If the width is larger than 1100px, set it 1100px, otherwise set property to auto.

To finish, no scripting language on the web is more widely supported than JavaScript.

share|improve this answer
You're right, it was only ever supported by IE<8. –  Kyle Sep 28 '10 at 7:31

Expressions are unique to IE and were dropped in 8:


More about expressions:


share|improve this answer
In IE9, calc from the real standardized CSS specification was added to substitute it, but what does one do for IE8 to still support this without using JavaScript? –  Mathias Lykkegaard Lorenzen Apr 10 '14 at 7:40

Firefox has a similar setup, XBL - check out this answer to a very similar question. HTML5 editor Ian Hickson recently stirred things up a little by releasing a new draft of the W3C attempt to standardize XBL (see also the WG response), so we may ultimately see something similar to Microsoft 's expressions as part of the HTML5 family of technologies.

share|improve this answer

Your Answer


