How do I add new CSS property to an existing class?
For example, if I got a class name .test
and already have some styling/properties.
And I'd like to add a new property color: blue;
to this class name by JavaScript.
How to do this?
const elm = document.querySelector('.test');
.test {
width: 200px;
height: 50px;
background-color: orange;
}
<div class="test">Testing...123</div>