I need to create a CSS stylesheet class dynamically in JavaScript and assign it to some HTML elements like - div, table, span, tr, etc and to some controls like asp:Textbox,
Looked through the answers and the most obvious and straight forward is missing: use document.write() to write out a chunk of CSS you need.
document.write()
Here is an example (view it on codepen: http://codepen.io/ssh33/pen/zGjWga):
Long Shadow Short Code