A declaration is important when its value ends with the tokens ! and important (whitespace, comments and case don't matter). Importance is decided at the first cascade step, with origin, so an important declaration beats every normal one before selectors are compared.
The origin order, strongest first, is:
- Transitions
- Important user agent
- Important user
- Important author
- Animations
- Normal author
- Normal user
- Normal user agent
Normal declarations go author > user > UA; important ones go UA > user > author. The reason is a balance of power. Authors normally win, but a user who needs large text or high contrast can mark their styles important and override the page. The browser can do the same for things that must hold: the HTML user-agent style sheet has input[type=hidden i] { display: none !important; }, and no author style can show that input.
The same reversal applies at two later steps:
- Layers: for normal declarations the last layer wins; for important ones the first layer wins. A reset or vendor layer can mark a value as required, and a later layer can't override it with its own
!important. - Shadow DOM context: normal styles from the page beat a component's; important styles from inside the component beat the page's.
Other steps aren't reversed: inline !important beats any style sheet !important, and specificity and source order still decide within one layer.
Animations sit between normal and important author styles: a running @keyframes animation overrides normal rules but loses to !important, and !important inside a keyframe is ignored. Transitions sit above everything: they only animate between values the cascade already chose, so they can't be used to beat a user's styles.