Pure JS Add Styles

by Preston Badeer

HTML

asdfasdfasdf

JavaScript

var css = '*{background:#444 !important;color:lightgrey !important;}',
    head = document.head || 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));
}

head.appendChild(style);