xxxxxxxxxx
element.style["name_of_css_property"]="property_value"
/*Ex:
* my_text_input.style["text-transform"]="capitalize";
*/
xxxxxxxxxx
var style = document.createElement('style');
style.innerHTML = `
#target {
color: blueviolet;
}
`;
document.head.appendChild(style);
xxxxxxxxxx
// Create our shared stylesheet:
const sheet = new CSSStyleSheet();
sheet.replaceSync('#target {color: darkseagreen}');
// Apply the stylesheet to a document:
document.adoptedStyleSheets = [sheet];
xxxxxxxxxx
var element = document.createElement('select');
element.style.maxWidth = "100px";
xxxxxxxxxx
var style = document.createElement('style');
document.head.appendChild(style);
style.sheet.insertRule('#target {color: darkseagreen}');