0

How do you add CSS rules using JavaScript?

For example

.center{margin:auto;width:900px}
jwpfox
  • 5,124
  • 11
  • 45
  • 42

1 Answers1

-1

Try This:

var myElement = document.querySelector("#superman");
myElement.style.backgroundColor = "#D93600";
jwpfox
  • 5,124
  • 11
  • 45
  • 42
VPK
  • 3,010
  • 1
  • 28
  • 35