javascripttutorial.net
JavaScript Tutorial
https://www.javascripttutorial.net › dom › css › add-styles-to-an-element
Style Property
In this case, the += operator appends the new style string to the existing one. The following css() helper function is used to set multiple styles for an element from an object of key-value pairs: function css (e, styles) { for (const property in styles) e.style[property] = styles[property]; } Code language: JavaScript (javascript)