View Full Version : can you manipulate values in CSS

Feb 22nd, 2003, 03:06 AM
or is there anything in the proposals for XSL-style imutables, or even real variables?

Feb 22nd, 2003, 03:35 AM
Manipulate *what* values?

Feb 22nd, 2003, 03:37 AM
Well, something like

div#something { color:red; }
div#other { color:css-eval(value-of-div#something.color); }


div#something { height:50px; }
div#other { height:css-eval(value-of-div#something.height*4)px; }

Don't know really; it was just an abstract thought .. computational CSS could be very useful ... although arguably unecessary, cos of XSL

Feb 22nd, 2003, 03:43 AM
Oh, I see.

Internet Explorer has a proprietary expression() value, which can be used like so:

someselector {
some-property: expression(javascript code);

Now, say you have expression(document.body.clientWidth);

The nifty thing about expression() is that if the value of the code inside the argument changes, it updates the property to reflect that. i.e. if someone resized the window, the above expression would update to reflect that.

Unfortunately, there is nothing similar to that in any standard.

The best workaround I can think of is to use Javascript's watch() method on an object (note: Javascript, not IE's JScript), and use DOM2 CSS inside the function be called on watch() to manipulate the property.

Feb 22nd, 2003, 04:28 AM
okay; thanks. I'm not actually familair with watch(), but I can find out.

Feb 22nd, 2003, 04:33 AM


Feb 23rd, 2003, 03:38 AM
Wow, great question brothercake. I had never thought about doing that before, but it would be quite useful!! One question though, seeing as I am ignorant when it comes to XSL, but how would this problem be solved through XSL?