How to set CSS style in typescript

Topics: Language Specification
Feb 27, 2014 at 9:54 PM
first i tried:
node.style = "position:absolute;overflow:hidden;width:100%;height:100%;top:0;left:0";
but it gives this error:
error TS2012: Cannot convert 'string' to 'MSStyleCSSProperties':
Type 'String' is missing property 'pixelWidth' from type 'MSStyleCSSProperties'.
then i tried:
node.setAttribute('style', 'position:absolute;overflow:hidden;width:100%;height:100%;top:0;left:0;border:1px solid black;');
and this worked.
Feb 28, 2014 at 3:56 PM
One may set styles individually
node.style.position = "absolute";
node.style.overflow = "hidden";
// etc
or all at once
node.style.cssText = "position:absolute;overflow:hidden;width:100%;height:100%;top:0;left:0";
BTW the question should really be "How to set CSS style in JavaScript".