Skip to content

Rabbitzzc/operate-css

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

operate-css

Insert CSS into head, or insert CSS attributes into any element. npm -> operate-css

usage

install

yarn add dom
npm install dom 

import dom from 'dom'

css()

// css({ el, styles }: { el: { style: { [x: string]: any } }; styles: { [x: string]: any } })
const el = document.getElementById('#dom')
const styles = {
    color: 'red',
    backgroundColor: 'lightblue'
}
dom.css(el, styles)

getStyleValue()

// getStyleValue({ el, attr }: { el: HTMLElement; attr: string; })
const el = document.getElementById('#dom')
dom.getStyleValue(el, 'backgroundColor')

insertCSS()

// insertCSS(css: string, options: { target?: any; prepend?: boolean })
// insert a string of css into the <head>
const css = 'body { background:blue; }'
const options = {
    target: 'head', // element
    prepend: true // true ?  'prepend' : 'append'
}
dom.insertCSS(css, options)

About

Insert CSS into head, or insert CSS attributes into any element.

Resources

License

Stars

1 star

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors