Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
JS Vanilla Snippets
export function addHeadStyle (css) {
const head = document.head || document.getElementsByTagName('head')[0]
const style = document.createElement('style')
style.type = 'text/css'
if (style.styleSheet) {
style.styleSheet.cssText = css
} else {
return head.appendChild(style)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.