Here is an example of my HTML and CSS:
<div id="login-light" class="bg-green"></div>
In my CSS, I have defined the following styles:
#login-light {
background-color: red;
}
.bg-green {
background-color: green;
}
I would like to know how to make the element's background color green when it has the class .bg-green
. I understand that the CSS for an id takes precedence over a class. Is there a way to achieve this without using JavaScript?