Skip to content

Instantly share code, notes, and snippets.

@robinweser
Last active August 29, 2015 14:23
Show Gist options
  • Save robinweser/9dfd78ce5e58513a1eda to your computer and use it in GitHub Desktop.
Save robinweser/9dfd78ce5e58513a1eda to your computer and use it in GitHub Desktop.
fastest way to manually apply a stylesheet to your document
//creates a new <style></style>-tag
var style = document.createElement('style');
/*** GENERATE CSS HERE ***/
//adds the whole css rules to your styles tag
style.appendChild(document.createTextNode(CSS));
//applied it to your head which now start effecting your DOM
document.head.appendChild(style)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment