What’s the DOM? #6

In this article, I guide you on how to manipulate or alter the style of an HTML element via the style method inside JS.

According to the CSS when we write inside an HTML file we use the style tag to write in as well in JS we use the style method to alter the style of an HTML element.

For example, we have h1 tag with some text inside it. I want to alter or change its color,font-size,font-family…

If you try it inside your own text-editor and open it in your favorite browser you’ll see the result.

In javascript when adding style we don’t use space or ‘-’ to separate the words we use camel case letters for example fontSize,fontFamily,backgroundColor…

As well we write our style inside quotes keep this in mind.