setStyle and CSS calc


obj.setStyle("left","calc(99% - 210px)");

I belive it is right CSS, but it dosn't work.

Should it??

May 8,
I'm not aware of a CSS function called calc(). That doesn't mean there isn't one, but if you can point me to it here http://www.w3.org/Style/CSS/ I'd be willing to read it's specs.

On the other hand, assuming there is one, does your browser support it?
May 8,

Yes, you have right.

calc is in CSS version 3.0.

Here is the link any way:


section 3.74

I just to have to wait, or manage a other way.

Still, thanks a lot.

May 8,
If all current browsers implement this calc() function - live would be so much easier :-)
Alex (ActiveWidgets)
May 9,
It would be even better if you could use JavaScript functions in the CSS properties. But I'd be happy just to be able to access the CSS properties from JavaScript.
May 9,
Actually, it is possible to use javascript functions in CSS -

#myDIV {
  width: expression(this.parentNode.clientWidth/2 - 100);


Unfortunately this is available in IE only, and it also affects performance (if you use too many of them :-).

And, BTW you can manipulate stylesheets from javascripts as well -



Alex (ActiveWidgets)
May 9,
Yes, I know. Unfortunately, IE isn't my preferred browser.

Right now, my resize javascript routine is coming together. I'm just ironing out the last issues I've uncovered with objects that have a float right style. It would be nice if I could access the styles from JS with FireFox. Unfortunately, I have to resort to passing extra parameters to the resize function.

Of course, while it mostly works fine with the Gecko-based browsers, IE is stuffed. Damn you, Bill Gates!
May 9,

This topic is archived.

See also:

Back to support forum