You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
![]() |
5 years ago | |
---|---|---|
.. | ||
LICENSE | 5 years ago | |
example.js | 5 years ago | |
index.js | 5 years ago | |
package.json | 5 years ago | |
readme.markdown | 5 years ago | |
test.js | 5 years ago |
readme.markdown
insert-css
insert a string of css into the <head>
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 todocument.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