Is it possible to rewrite a CSS property via a link, or is this more of a javascript or PHP thing?

ex.
/* initial state: */
h1 {color: red}
/* desired state: */
h1 {color: green}

HTML:
<a href="#">change h1 elements to green</a>