Answers for "javascript how to assign multiple style rules on an element. element.style ="

CSS
3

how to add multiple css style in javascript

document.getElementById("myElement").style.cssText = "display: block; position: absolute";

//use template literals
document.getElementById("myElement").style.cssText = `
  display: block; 
  position: absolute;
`;
Posted by: Guest on December-27-2021
0

how to add multiple styles in javascript

Object.assign(yourelement.style,{fontsize:"12px",left:"200px",top:"100px"});
Posted by: Guest on September-02-2020

Code answers related to "javascript how to assign multiple style rules on an element. element.style ="

Browse Popular Code Answers by Language