add css style to javascript code example
Example 1: add style javascript
// Bad:
element.setAttribute("style", "background-color: red;");
// Good:
element.style.backgroundColor = "red";
Example 2: js add css to document
document.querySelector('head').innerHTML += '<link rel="stylesheet" href="styles.css" type="text/css"/>';