Learn HTML DOM
Manipulating DOM Elements
4.13
Lesson

Changing Page Styles

We can change the styling of an HTML element using the style property.

If you look at the console, you’ll see that all the different style properties that you see inside the CSSStyleDeclaration are in camel case. This is different from how we write them in CSS, separated by a hyphen.

Let’s try changing the width and font-size of this square div: