View Full Version : can you manipulate values in CSS
brothercake
02-22-2003, 02:06 AM
or is there anything in the proposals for XSL-style imutables, or even real variables?
Manipulate *what* values?
brothercake
02-22-2003, 02:37 AM
Well, something like
div#something { color:red; }
div#other { color:css-eval(value-of-div#something.color); }
or
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
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.
brothercake
02-22-2003, 03:28 AM
okay; thanks. I'm not actually familair with watch(), but I can find out.
http://devedge.netscape.com/library/manuals/2000/javascript/1.5/reference/object.html#1193628
:)
pardicity3
02-23-2003, 02: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?
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.