Function: addCss()
ts
function addCss(
selector,
cssRules,
title?): void;Add CSS rules to a stylesheet with a given title. If a stylesheet with that title does not exist, it will be created.
Parameters
| Parameter | Type | Default value | Description |
|---|---|---|---|
selector | string | undefined | The CSS selector to which to apply the rules. |
cssRules | StyleProps | undefined | An object containing CSS rules to apply. |
title | string | 'sheet' | The title of the stylesheet. |
Returns
void
Example
ts
addCss('.my-class', { color: 'red', backgroundColor: 'blue' }, 'my-stylesheet')
console.log(document.querySelectorAll('style').length > 0)Since
1.0.0