Skip to content

Function: removeCssVariable()

ts
function removeCssVariable(key, ele?): void;

Removes a CSS variable from the specified element or the root element.

Parameters

ParameterTypeDescription
keystringThe name of the CSS variable to remove.
ele?HTMLElementThe element from which to remove the CSS variable. If not specified, defaults to the root element.

Returns

void

Example

ts
// Remove a CSS variable from the root element
removeCssVariable('--main-bg-color');

// Remove a CSS variable from a specific element
const element = document.querySelector('.my-element');
removeCssVariable('--main-bg-color', element)

Since

1.0.0

Released under the MIT License.