0 votes
in JavaScript by
How do you change the style of a HTML element?

1 Answer

0 votes
by

You can change inline style or classname of a HTML element using javascript

  1. Using style property: You can modify inline style using style property
document.getElementById("title").style.fontSize = "30px";
  1. Using ClassName property: It is easy to modify element class using className property
document.getElementById("title").className = "custom-title";
...