I do not believe that specific technique is possible, but you can dynamically change CSS through Javascript, including a specific element's CSS (by ID).
Its Amazing, why do you want to do that when javascript can handle the css and even you will not have to write any of the css code. Javascript can perform everything and more which css can perform.
CSS basics are to improve interface and giving a good design. It was all possible through javascript but CSS makes it easy to handle the design. And javascript for validation and other logical client base tasks.