document.getElementById("demo").style.display = "none";
div.style.color = 'blue';
// adds the indicated style rule
div.style.cssText = 'color: blue; background: white';
// adds several style rules
div.setAttribute('style', 'color: blue; background: white');
// adds several style rules
document.getElementById("myH1").style.color = "red";
var style = document.createElement('style');
style.innerHTML = `
#target {
color: blueviolet;
}
`;
document.head.appendChild(style);
// Create our shared stylesheet:
const sheet = new CSSStyleSheet();
sheet.replaceSync('#target {color: darkseagreen}');
// Apply the stylesheet to a document:
document.adoptedStyleSheets = [sheet];
var element = document.createElement('select');
element.style.maxWidth = "100px";
var style = document.createElement('style');
document.head.appendChild(style);
style.sheet.insertRule('#target {color: darkseagreen}');
//on HTML *Purist Style* || *Only JavaScript*
<style> //
.example { // para.style.color = 'white';
color: white; // para.style.background = 'black';
background-color: black; // para.style.padding = '10px';
padding: 10px; // para.style.width = '250px';
width: 250px; // para.style.textAlign = 'center';
text-align: center;
}
</style>
// on JavaScript
Element.setAttribute('class', 'highlight');
document.getElementById('target').style.color = 'tomato';
marquee ngu