User NickC asks here if it is possible to set an element's position (or similar style properties) in js using CSS's calc() function.
Example:
var pad = "calc(1250px - 1000px)";
element.style.paddingLeft = pad;
This shows up just fine on my web page, but I would like to include a js variable in the function, like so:
var pad = "calc("+ width +"- 1000px)";
alert(pad); //displays calc( 1250px - 1000px)
element.style.paddingLeft = pad;
I included the alert statement to assure myself that the string itself was correct, which it appears to be. However, the desired padding does not appear.
Is there a problem with what I'm doing, or is it just not possible to do this?