There is a div, and it has 2 class names.
like - What I want is that if there are .A.B {}, the it will deprec
In css whatever comes last takes precedence - that is why it is called a cascading style sheet. The exceptions to this are if the !important flag is used or if the previous selector is more specific than the latter. In your case .A.B{} is more specific and so it will automatically override any of the same attributes in .A{} and .B{}. If you want an attribute in .B{} to override an attribute in .B{} or vice versa you just need to make sure it comes last.