Since both the classes have same specificity, the class which is defined later will override conflicting styles.
Thus in your example:
.classA:hover{
transform: translateX(10px);
color: white;
}
.classB:hover{
color: red;
}
classB
is defined later so color: red
will be applied and since transform: translateX(10px)
is not conflicting it will also be applied.
NOTE:
Writing either <div class="classA classB"></div>
or <div class="classB classA"></div>
will yield the same result.
But if the class definitions were reversed:
.classB:hover{
color: red;
}
.classA:hover{
transform: translateX(10px);
color: white;
}
Then transform: translateX(10px)
and color: white
will be applied.