HTML Interview Questions

RMAG news

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”;

Leave a Reply

Your email address will not be published. Required fields are marked *