Ciao, con jQuery potresti aggiungere un tag style al volo, in questo modo:<br>
codice HTML:
var css = "body{ background-color: red;} .container{width:100%;height:500px;}";<br>$("head").append("&lt;style type='text/css'&gt;"+css+"&lt;/style&gt;");
<br><br>O comunque selezionare un tag style specifico e inserire la stringa come html.<br>Un esempio pratico:<br>
codice HTML:
&lt;!DOCTYPE HTML&gt;<br>&lt;html&gt;<br>&nbsp; &lt;head&gt;<br>&nbsp;&nbsp;&nbsp; &lt;title&gt;Esempio&lt;/title&gt;<br>&nbsp;&nbsp;&nbsp; &lt;meta charset="utf-8"&gt;<br>&nbsp;&nbsp;&nbsp; &lt;script src="http://code.jquery.com/jquery-latest.min.js"&gt;&lt;/script&gt;<br>&nbsp;&nbsp;&nbsp; &lt;style id="tagStyle" type="text/css"&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;<br>&nbsp;&nbsp;&nbsp; &lt;/style&gt;<br>&nbsp;&nbsp;&nbsp; &lt;style style="text/css"&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* Ll css definito qui dentro resterà inalterato perché sovrascrive eventuali regole definite in tagStyle */<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #txtCss{width:100%;height:200px;}<br>&nbsp;&nbsp;&nbsp; &lt;/style&gt;<br>&nbsp;&nbsp;&nbsp; &lt;script type="text/javascript"&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $(function(){<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $("#applica").click(function(){<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var css = $("#txtCss").val();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $("#tagStyle").html(css);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; });<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; });<br>&nbsp;&nbsp;&nbsp; &lt;/script&gt;<br>&nbsp; &lt;/head&gt;<br>&nbsp; &lt;body&gt;<br>&nbsp;&nbsp;&nbsp; &lt;textarea id="txtCss"&gt;<br>body{<br>&nbsp; background-color: red;<br>}<br>.container{<br>&nbsp; width:100%;<br>&nbsp; height:500px;<br>}<br>&nbsp;&nbsp;&nbsp; &lt;/textarea&gt;<br>&nbsp;&nbsp;&nbsp; &lt;br&gt;&lt;input id="applica" type="button" value="Applica css"&gt;<br>&nbsp;&nbsp;&nbsp;
 &lt;div class="container"&gt;Lorem ipsum dolor sit amet, consectetur 
adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore 
magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco
 laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor 
in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla 
pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa 
qui officia deserunt mollit anim id est laborum.&lt;/div&gt;<br>&nbsp; &lt;/body&gt;<br>&lt;/html&gt;