js添加css到head中

<script>
    var style = document.createElement("style");
    style.type = "text/css";
    style.innerHTML = 'body{background:pink;}';
    window.document.head.appendChild(style);
</script>

  

原文地址:https://www.cnblogs.com/wulinzi/p/15627567.html