I use the following code to make all text red in a webpage:
var myCss = document.createElement("style");
myCss.type = "text/css";
myCss.innerHTML = " * {color: red !important} ";
document.body.appendChild(myCss);
This code works but I need a way to insert a few rows of CSS code, instead just one.
I tried this instead, but didn't work:
var cssArray = ["
* {color: blue !important}
* {background: white !important}
#myId {display: block}
.myClass {display: inline-block}
"];
var myCss = document.createElement("style");
myCss.type = "text/css";
myCss.innerHTML = cssArray;
document.body.appendChild(myCss);
I went through many SE QA sessions and all I found deals with adding a single CSS row as I used above. If there is no way to inject several CSS rows in one command, is there any "dirty" workaround you know?