ID trumps class specificity as MDN states:
The following list of selectors is by increasing specificity:
- Universal selectors
- Type selectors
- Class selectors
- Attributes selectors
- Pseudo-classes
- ID selectors
- Inline style
The specificity calculation can be a bit confusing, but you need to remember, as the W3 states, that when calculating the specificity that you concatenate, not add the numbers together.
So for example:
- #id has a specificity = 0,1,0,0
- .a.b.c.d.e.f.g.h.i.j.k.l has a specificity = 0,0,12,0
So yes, the ID will trump the pure class selection every time.