Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

insert-css

2.0.0 • Public • Published

insert-css

insert a string of css into the <head>

browser support

example

    var insertCss = require('insert-css');
    var styleElement = insertCss('body { background:blue; }');

api

    var insertCss = require('insert-css');

var styleElement = insertCss(css, opts);

Insert some CSS into the page.

  • opts.container - Which HTMLElement to use as the base mounting point, defaults to document.querySelector('head').

  • opts.prepend - Add the CSS at the top level of the container instead of at the bottom level (default).

This is particullary useful for library creators where you may want your default CSS to be prepended so it can be easily overriden by user styles.

development

example

npm run example

test

npm test

install

npm i insert-css

Downloadsweekly downloads

131,625

version

2.0.0

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
  • avatar
  • avatar
Report a vulnerability