Last active
October 26, 2018 03:45
-
-
Save ajhsu/0f873d49a23cf48134e994ac8f248c09 to your computer and use it in GitHub Desktop.
Dynamically injects an inline stylesheet into a web page
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 style = document.createElement('style'); | |
style.type = 'text/css'; | |
style.innerHTML = ` | |
body { | |
background-color: yellow; | |
} | |
`; | |
document.querySelector('head').appendChild(style); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment