Created
October 20, 2014 20:32
-
-
Save mediamichael/b1c7f577d3d054b94cf1 to your computer and use it in GitHub Desktop.
Append CSS with JS
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 css = '@import url(http://fonts.googleapis.com/css?family=Roboto:400,100,100italic,300,300italic,400italic,900,700,500,500italic,700italic,900italic);', | |
header = document.getElementsByTagName("head")[0], | |
style = document.createElement('style'); | |
style.type = 'text/css'; | |
if (style.styleSheet){ | |
style.styleSheet.cssText = css; | |
} else { | |
style.appendChild(document.createTextNode(css)); | |
} | |
header.appendChild(style); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment