Suppose I have two classes in a div
like in the example below
.class1 {
background-color: blue;
border: solid black;
}
.class2 {
background-color: red;
border: solid black;
}
<div>
<div class="class1 class2">
This is red
</div>
<br>
<div class="class2 class1">
This should have been blue but its red
</div>
</div>
There doesn't seem to be any rule regarding which class takes the precedence.
Why both the boxes has a red background in the output?