Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Set CSS styles with javascript

// Create our shared stylesheet:
const sheet = new CSSStyleSheet();
sheet.replaceSync('#target {color: darkseagreen}');

// Apply the stylesheet to a document:
document.adoptedStyleSheets = [sheet];
Source by dev.to #
 
PREVIOUS NEXT
Tagged: #Set #CSS #styles #javascript
ADD COMMENT
Topic
Name
5+6 =