April 17, 2024, 7:15 a.m. | FatimaAlam1234

DEV Community dev.to

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

change class document easy element html interview interview questions javascript property questions style

Data Architect

@ University of Texas at Austin | Austin, TX

Data ETL Engineer

@ University of Texas at Austin | Austin, TX

Lead GNSS Data Scientist

@ Lurra Systems | Melbourne

Senior Machine Learning Engineer (MLOps)

@ Promaton | Remote, Europe

C003549 Data Analyst (NS) - MON 13 May

@ EMW, Inc. | Braine-l'Alleud, Wallonia, Belgium

Marketing Decision Scientist

@ Meta | Menlo Park, CA | New York City