Overview

The cascade resolves conflicts when several declarations target the same property on the same element. When a style refuses to apply, debug the cascade before adding !important: the winner is usually a different layer, higher specificity, or later source position.

Rules

The first step that differs decides the winner:

  1. Origin and importance. Author !important beats normal author styles; user-agent and user !important beat author !important. Animations and transitions rank above normal declarations.
  2. Inline style attributes beat selector rules of the same origin and importance.
  3. Cascade layers (@layer). For normal declarations, later layers win and unlayered styles beat all layers. For !important the order reverses: earlier layers win and unlayered loses.
  4. specificity.
  5. @scope proximity, then source order (the last declaration wins).

Properties no rule sets inherit from the parent (text properties such as color) or take the initial value (layout properties such as width). Put third-party CSS in an early layer so your unlayered styles win without !important.

@layer base, components;
@layer components { .card p { color: teal; } }
p { color: black; } /* unlayered: wins despite lower specificity */