Frontend & browser·Layout, CSS and the cascade
two rules both apply to the element and the browser follows a fixed set of tie-breaks to pick one.
The cascade
Also calledCSS cascade, cascading
The algorithm that resolves competing declarations for the same property on the same element, in order: origin and importance, then cascade layer, then specificity, then source order. It is deterministic, which means every 'CSS is unpredictable' complaint is really a step in this list that was not checked. Knowing the order matters because the fix is different at each step, and reaching for `!important` skips the diagnosis entirely.