Created
October 22, 2015 13:33
-
-
Save tobireif/ba62afcee6c19c4025c6 to your computer and use it in GitHub Desktop.
Appending CSS using Javascript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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