Skip to content

SVGElement.setCssProps method

SVGElement › setCssProps

Official

Sets the CSS properties of the element.

Signature:

setCssProps(props: Record<string, string>): void

Parameters:

Parameter Type Description
props Record<string, string> The properties to set.

Returns: void

Example:

const element = document.body.createEl('svg');
element.setCssProps({ color: 'red', 'font-size': '16px' });