Element.style.cssText property
Kevin Beck
—January 02, 2021
So found out about Element.style.cssText property today. You can get in-line styles of an element:
let styles = yourElement.style.cssText;
Or to add / update in-line styles:
// Remove the existing styles and replaces them with these:yourElement.style.cssText = 'color: blue; font-size: 2rem';// Add to the existing styles with these:yourElement.style.cssText += 'color: red;';