That’s entirely possible. If you specify two classes on an element (without any spaces), that means that it must have both for the rule to apply.
div.a {
color: blue;
}
div.b {
color: green;
}
div.a.b {
color: red;
}
<div class="a">
A
</div>
<div class="b">
B
</div>
<div class="a b">
AB
</div>