Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSS

Set Multiple CSS Styles using Javascript

document.getElementById("myElement").style.cssText = `
  display: block; 
  position: absolute;
`;
//Remeber the quotation marks should be template literal ones
//If you created the style value as a variable, 
//you can use template literal like display: ${myDisplay}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #Set #Multiple #CSS #Styles #Javascript
ADD COMMENT
Topic
Name
7+1 =