Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Appending CSS using Javascript
var head = document.documentElement.querySelector("head");
var styleEl = document.createElement("style");
var styleStr = document.createTextNode(
"#content {prop: val}"
);
styleEl.appendChild(styleStr);
head.appendChild(styleEl);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.