Modifying CSS
Tying CSS Changes to User Interaction
We'll cover the following
The Element.style
property #
The easiest way to change CSS styles on an HTML element using Javascript is to access individual styles in the Element.style
property.
Since Element.style
is also an object, there are many sub-properties that target specific CSS properties. For instance, we could add a border to an element using Element.style.border
:
Create a free account to access the full course.
By signing up, you agree to Educative's Terms of Service and Privacy Policy