DEV Community


Posted on

HTML Interview Questions

Q. How do you change the style of a HTML element
You can change inline style or classname of a HTML element using javascript

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

Top comments (0)